Java Code Examples for org.bukkit.Material#STANDING_BANNER

The following examples show how to use org.bukkit.Material#STANDING_BANNER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Uncarried.java    From PGM with GNU Affero General Public License v3.0 6 votes vote down vote up
public Uncarried(Flag flag, Post post, @Nullable Location location) {
  super(flag, post);
  if (location == null) location = flag.getReturnPoint(post);
  this.location =
      new Location(
          location.getWorld(),
          location.getBlockX() + 0.5,
          location.getBlockY(),
          location.getBlockZ() + 0.5,
          location.getYaw(),
          location.getPitch());

  Block block = this.location.getBlock();
  if (block.getType() == Material.STANDING_BANNER) {
    // Banner may already be here at match start
    this.oldBlock = BlockStates.cloneWithMaterial(block, Material.AIR);
  } else {
    this.oldBlock = block.getState();
  }
  this.oldBase = block.getRelative(BlockFace.DOWN).getState();
}
 
Example 2
Source File: Uncarried.java    From ProjectAres with GNU Affero General Public License v3.0 6 votes vote down vote up
public Uncarried(Flag flag, Post post, @Nullable Location location) {
    super(flag, post);
    if(location == null) location = flag.getReturnPoint(post);
    this.location = new Location(location.getWorld(),
                                 location.getBlockX() + 0.5,
                                 location.getBlockY(),
                                 location.getBlockZ() + 0.5,
                                 location.getYaw(),
                                 location.getPitch());

    if(!flag.getMatch().getWorld().equals(this.location.getWorld())) {
        throw new IllegalStateException("Tried to place flag in the wrong world");
    }

    Block block = this.location.getBlock();
    if(block.getType() == Material.STANDING_BANNER) {
        // Banner may already be here at match start
        this.oldBlock = BlockStateUtils.cloneWithMaterial(block, Material.AIR);
    } else {
        this.oldBlock = block.getState();
    }
    this.oldBase = block.getRelative(BlockFace.DOWN).getState();
}