public static boolean checkIfBlockBreaksSigns(final Block block) {
   final Block sign = block.getRelative(BlockFace.UP);
   if (sign.getType() == Material.SIGN_POST && isValidSign(new BlockSign(sign))) {
     return true;
   }
   final BlockFace[] directions =
       new BlockFace[] {BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST};
   for (BlockFace blockFace : directions) {
     final Block signblock = block.getRelative(blockFace);
     if (signblock.getType() == Material.WALL_SIGN) {
       final org.bukkit.material.Sign signMat =
           (org.bukkit.material.Sign) signblock.getState().getData();
       if (signMat.getFacing() == blockFace && isValidSign(new BlockSign(signblock))) {
         return true;
       }
     }
   }
   return false;
 }
Beispiel #2
0
  /**
   * @param action_type
   * @param block
   * @param player
   */
  public void setBlock(Block block, String[] lines) {

    // Build an object for the specific details of this action
    actionData = new SignChangeActionData();

    if (block != null) {
      actionData.sign_type = block.getType().name();
      org.bukkit.material.Sign sign = (org.bukkit.material.Sign) block.getState().getData();
      actionData.facing = sign.getFacing();
      this.block = block;
      this.world_name = block.getWorld().getName();
      this.x = block.getX();
      this.y = block.getY();
      this.z = block.getZ();
    }
    if (lines != null) {
      actionData.lines = lines;
    }
  }