Java 类org.bukkit.material.TrapDoor 实例源码

项目:SupaCommons    文件:BlockUtils.java   
/**
 * Opens a door {@link Block}. This method takes no action if the given block is not a door, or
 * if it is already open.
 *
 * @param block door block to open
 *
 * @return whether any action was taken. The cases in which it is false is if the block is not a
 * door, or the door is already open.
 */
public static boolean openDoor(Block block) {
  if (!isDoor(block)) {
    return false;
  }

  if (block.getType() == Material.TRAP_DOOR) {
    BlockState state = block.getState();
    TrapDoor trapdoor = (TrapDoor) state.getData();
    trapdoor.setOpen(true);
    state.update();
    return true;
  } else {
    block = getBottomDoorBlock(block);
    if (isDoorClosed(block)) {
      block.setData((byte) (block.getData() | 0x4), true);
      block.getWorld().playEffect(block.getLocation(), Effect.DOOR_TOGGLE, 0);
      return true;
    }
  }
  return false;
}
项目:SupaCommons    文件:BlockUtils.java   
/**
 * Closes a door {@link Block}. This method takes no action if the given block is not a door, or
 * if it is already open.
 *
 * @param block door block to open
 *
 * @return whether any action was taken. The cases in which it is false is if the block is not a
 * door, or the door is already closed.
 */
public static boolean closeDoor(Block block) {
  if (!isDoor(block)) {
    return false;
  }

  if (block.getType() == Material.TRAP_DOOR) {
    BlockState state = block.getState();
    TrapDoor trapdoor = (TrapDoor) state.getData();
    trapdoor.setOpen(false);
    state.update();
    return true;
  } else {
    block = getBottomDoorBlock(block);
    if (!isDoorClosed(block)) {
      block.setData((byte) (block.getData() & 0xb), true);
      block.getWorld().playEffect(block.getLocation(), Effect.DOOR_TOGGLE, 0);
      return true;
    }
  }
  return false;
}
项目:Wayward    文件:PlayerInteractListener.java   
public void openDoor(Block block) {
    if (block.getType() == Material.TRAP_DOOR) {
        BlockState state = block.getState();
        TrapDoor trapdoor = (TrapDoor)state.getData();
        trapdoor.setOpen(true);
        state.update();
    } else {
        byte data = block.getData();
        if ((data & 0x8) == 0x8) {
            block = block.getRelative(BlockFace.DOWN);
            data = block.getData();
        }
        if (isDoorClosed(block)) {
            data = (byte) (data | 0x4);
            block.setData(data, true);
            block.getWorld().playEffect(block.getLocation(), Effect.DOOR_TOGGLE, 0);
        }
    }
}
项目:Wayward    文件:PlayerInteractListener.java   
public void closeDoor(Block block) {
    if (block.getType() == Material.TRAP_DOOR) {
        BlockState state = block.getState();
        TrapDoor trapdoor = (TrapDoor)state.getData();
        trapdoor.setOpen(false);
        state.update();
    } else {
        byte data = block.getData();
        if ((data & 0x8) == 0x8) {
            block = block.getRelative(BlockFace.DOWN);
            data = block.getData();
        }
        if (!isDoorClosed(block)) {
            data = (byte) (data & 0xb);
            block.setData(data, true);
            block.getWorld().playEffect(block.getLocation(), Effect.DOOR_TOGGLE, 0);
        }
    }
}
项目:Transport-Pipes    文件:HitboxUtils.java   
/**
 * checks if this block would give a reaction if you click on it without
 * shifting, e.g. opening a chest or switching a lever
 */
public static boolean isInteractiveBlock(Block b) {
    if (b == null || b.getState() == null) {
        return false;
    }
    if (b.getType() == Material.WORKBENCH || b.getType() == Material.ENCHANTMENT_TABLE || b.getType() == Material.ANVIL || b.getType() == Material.BREWING_STAND || b.getState() instanceof InventoryHolder || b.getState() instanceof NoteBlock) {
        return true;
    }
    if (b.getState().getData() instanceof Button || b.getState().getData() instanceof Lever || b.getState().getData() instanceof Door || b.getState().getData() instanceof TrapDoor || b.getState().getData() instanceof Gate || b.getState().getData() instanceof Comparator) {
        if (b.getType() != Material.IRON_DOOR && b.getType() != Material.IRON_DOOR_BLOCK && b.getType() != Material.IRON_TRAPDOOR) {
            return true;
        }
    }
    return false;
}
项目:Wayward    文件:PlayerInteractListener.java   
public boolean isDoorClosed(Block block) {
    if (block.getType() == Material.TRAP_DOOR) {
        TrapDoor trapdoor = (TrapDoor)block.getState().getData();
        return !trapdoor.isOpen();
    } else {
        byte data = block.getData();
        if ((data & 0x8) == 0x8) {
            block = block.getRelative(BlockFace.DOWN);
            data = block.getData();
        }
        return ((data & 0x4) == 0);
    }
}
项目:bskyblock    文件:IslandsManager.java   
/**
 * Checks if this location is safe for a player to teleport to. Used by
 * warps and boat exits Unsafe is any liquid or air and also if there's no
 * space
 *
 * @param l
 *            - Location to be checked
 * @return true if safe, otherwise false
 */
public static boolean isSafeLocation(final Location l) {
    if (l == null) {
        return false;
    }
    // TODO: improve the safe location finding.
    //Bukkit.getLogger().info("DEBUG: " + l.toString());
    final Block ground = l.getBlock().getRelative(BlockFace.DOWN);
    final Block space1 = l.getBlock();
    final Block space2 = l.getBlock().getRelative(BlockFace.UP);
    //Bukkit.getLogger().info("DEBUG: ground = " + ground.getType());
    //Bukkit.getLogger().info("DEBUG: space 1 = " + space1.getType());
    //Bukkit.getLogger().info("DEBUG: space 2 = " + space2.getType());
    // Portals are not "safe"
    if (space1.getType() == Material.PORTAL || ground.getType() == Material.PORTAL || space2.getType() == Material.PORTAL
            || space1.getType() == Material.ENDER_PORTAL || ground.getType() == Material.ENDER_PORTAL || space2.getType() == Material.ENDER_PORTAL) {
        return false;
    }
    // If ground is AIR, then this is either not good, or they are on slab,
    // stair, etc.
    if (ground.getType() == Material.AIR) {
        // Bukkit.getLogger().info("DEBUG: air");
        return false;
    }
    // In BSkyBlock, liquid may be unsafe
    if (ground.isLiquid() || space1.isLiquid() || space2.isLiquid()) {
        // Check if acid has no damage
        if (Settings.acidDamage > 0D) {
            // Bukkit.getLogger().info("DEBUG: acid");
            return false;
        } else if (ground.getType().equals(Material.STATIONARY_LAVA) || ground.getType().equals(Material.LAVA)
                || space1.getType().equals(Material.STATIONARY_LAVA) || space1.getType().equals(Material.LAVA)
                || space2.getType().equals(Material.STATIONARY_LAVA) || space2.getType().equals(Material.LAVA)) {
            // Lava check only
            // Bukkit.getLogger().info("DEBUG: lava");
            return false;
        }
    }
    MaterialData md = ground.getState().getData();
    if (md instanceof SimpleAttachableMaterialData) {
        //Bukkit.getLogger().info("DEBUG: trapdoor/button/tripwire hook etc.");
        if (md instanceof TrapDoor) {
            TrapDoor trapDoor = (TrapDoor)md;
            if (trapDoor.isOpen()) {
                //Bukkit.getLogger().info("DEBUG: trapdoor open");
                return false;
            }
        } else {
            return false;
        }
        //Bukkit.getLogger().info("DEBUG: trapdoor closed");
    }
    if (ground.getType().equals(Material.CACTUS) || ground.getType().equals(Material.BOAT) || ground.getType().equals(Material.FENCE)
            || ground.getType().equals(Material.NETHER_FENCE) || ground.getType().equals(Material.SIGN_POST) || ground.getType().equals(Material.WALL_SIGN)) {
        // Bukkit.getLogger().info("DEBUG: cactus");
        return false;
    }
    // Check that the space is not solid
    // The isSolid function is not fully accurate (yet) so we have to
    // check
    // a few other items
    // isSolid thinks that PLATEs and SIGNS are solid, but they are not
    if (space1.getType().isSolid() && !space1.getType().equals(Material.SIGN_POST) && !space1.getType().equals(Material.WALL_SIGN)) {
        return false;
    }
    if (space2.getType().isSolid()&& !space2.getType().equals(Material.SIGN_POST) && !space2.getType().equals(Material.WALL_SIGN)) {
        return false;
    }
    // Safe
    //Bukkit.getLogger().info("DEBUG: safe!");
    return true;
}
项目:bskyblock    文件:Util.java   
/**
 * Checks if this location is safe for a player to teleport to. Used by
 * warps and boat exits Unsafe is any liquid or air and also if there's no
 * space
 * 
 * @param l
 *            - Location to be checked
 * @return true if safe, otherwise false
 */
public static boolean isSafeLocation(final Location l) {
    if (l == null) {
        return false;
    }
    // TODO: improve the safe location finding.
    //Bukkit.getLogger().info("DEBUG: " + l.toString());
    final Block ground = l.getBlock().getRelative(BlockFace.DOWN);
    final Block space1 = l.getBlock();
    final Block space2 = l.getBlock().getRelative(BlockFace.UP);
    //Bukkit.getLogger().info("DEBUG: ground = " + ground.getType());
    //Bukkit.getLogger().info("DEBUG: space 1 = " + space1.getType());
    //Bukkit.getLogger().info("DEBUG: space 2 = " + space2.getType());
    // Portals are not "safe"
    if (space1.getType() == Material.PORTAL || ground.getType() == Material.PORTAL || space2.getType() == Material.PORTAL
            || space1.getType() == Material.ENDER_PORTAL || ground.getType() == Material.ENDER_PORTAL || space2.getType() == Material.ENDER_PORTAL) {
        return false;
    }
    // If ground is AIR, then this is either not good, or they are on slab,
    // stair, etc.
    if (ground.getType() == Material.AIR) {
        // Bukkit.getLogger().info("DEBUG: air");
        return false;
    }
    // In ASkyBlock, liquid may be unsafe
    if (ground.isLiquid() || space1.isLiquid() || space2.isLiquid()) {
        // Check if acid has no damage
        if (Settings.acidDamage > 0D) {
            // Bukkit.getLogger().info("DEBUG: acid");
            return false;
        } else if (ground.getType().equals(Material.STATIONARY_LAVA) || ground.getType().equals(Material.LAVA)
                || space1.getType().equals(Material.STATIONARY_LAVA) || space1.getType().equals(Material.LAVA)
                || space2.getType().equals(Material.STATIONARY_LAVA) || space2.getType().equals(Material.LAVA)) {
            // Lava check only
            // Bukkit.getLogger().info("DEBUG: lava");
            return false;
        }
    }
    MaterialData md = ground.getState().getData();
    if (md instanceof SimpleAttachableMaterialData) {
        //Bukkit.getLogger().info("DEBUG: trapdoor/button/tripwire hook etc.");
        if (md instanceof TrapDoor) {
            TrapDoor trapDoor = (TrapDoor)md;
            if (trapDoor.isOpen()) {
                //Bukkit.getLogger().info("DEBUG: trapdoor open");
                return false;
            }
        } else {
            return false;
        }
        //Bukkit.getLogger().info("DEBUG: trapdoor closed");
    }
    if (ground.getType().equals(Material.CACTUS) || ground.getType().equals(Material.BOAT) || ground.getType().equals(Material.FENCE)
            || ground.getType().equals(Material.NETHER_FENCE) || ground.getType().equals(Material.SIGN_POST) || ground.getType().equals(Material.WALL_SIGN)) {
        // Bukkit.getLogger().info("DEBUG: cactus");
        return false;
    }
    // Check that the space is not solid
    // The isSolid function is not fully accurate (yet) so we have to
    // check
    // a few other items
    // isSolid thinks that PLATEs and SIGNS are solid, but they are not
    if (space1.getType().isSolid() && !space1.getType().equals(Material.SIGN_POST) && !space1.getType().equals(Material.WALL_SIGN)) {
        return false;
    }
    if (space2.getType().isSolid()&& !space2.getType().equals(Material.SIGN_POST) && !space2.getType().equals(Material.WALL_SIGN)) {
        return false;
    }
    // Safe
    //Bukkit.getLogger().info("DEBUG: safe!");
    return true;
}
项目:beaconz    文件:Region.java   
/**
 * Checks if this location is safe for a player to teleport to.
 * Unsafe is any liquid or air and also if there's no space
 *
 * @param location
 *            - Location to be checked
 * @return true if safe, otherwise false
 */
public Boolean isLocationSafe(Location location) {
    // TODO: improve the safe location finding.
    // note: water lilies should not be safe

    if (location == null) {
        return false;
    }

    final Block ground = location.getBlock().getRelative(BlockFace.DOWN);
    final Block space1 = location.getBlock();
    final Block space2 = location.getBlock().getRelative(BlockFace.UP);

    // If ground is AIR, then this is either not good, or they are on slab,
    // stair, etc.
    if (ground.getType() == Material.AIR) {
        //Bukkit.getLogger().info("DEBUG: air");
        return false;
    }
    // Liquid is unsafe
    if (ground.isLiquid() || space1.isLiquid() || space2.isLiquid()) {
        return false;
    }

    // Portals are not "safe"
    if (space1.getType() == Material.PORTAL || ground.getType() == Material.PORTAL || space2.getType() == Material.PORTAL
            || space1.getType() == Material.ENDER_PORTAL || ground.getType() == Material.ENDER_PORTAL || space2.getType() == Material.ENDER_PORTAL) {
        return false;
    }

    MaterialData materialData = ground.getState().getData();
    if (materialData instanceof SimpleAttachableMaterialData) {
        //Bukkit.getLogger().info("DEBUG: trapdoor/button/tripwire hook etc.");
        if (materialData instanceof TrapDoor) {
            TrapDoor trapDoor = (TrapDoor)materialData;
            if (trapDoor.isOpen()) {
                //Bukkit.getLogger().info("DEBUG: trapdoor open");
                return false;
            }
        } else {
            return false;
        }
        //Bukkit.getLogger().info("DEBUG: trapdoor closed");
    }
    if (ground.getType().equals(Material.CACTUS) || ground.getType().equals(Material.BOAT) || ground.getType().equals(Material.FENCE)
            || ground.getType().equals(Material.NETHER_FENCE) || ground.getType().equals(Material.SIGN_POST) || ground.getType().equals(Material.WALL_SIGN)) {
        // Bukkit.getLogger().info("DEBUG: cactus");
        return false;
    }
    // We don't want to be standing on leaves either
    if (ground.getType().equals(Material.LEAVES)) {
        return false;
    }
    // Check that the space is not solid
    // The isSolid function is not fully accurate (yet) so we have to
    // check a few other items
    // isSolid thinks that PLATEs and SIGNS are solid, but they are not
    if (space1.getType().isSolid() && !space1.getType().equals(Material.SIGN_POST) && !space1.getType().equals(Material.WALL_SIGN)) {
        return false;
    }
    if (space2.getType().isSolid() && !space2.getType().equals(Material.SIGN_POST) && !space2.getType().equals(Material.WALL_SIGN)) {
        return false;
    }
    // Safe
    return true;
}
项目:askygrid    文件:GridManager.java   
/**
    * Checks if this location is safe for a player to teleport to. Used by
    * warps and boat exits Unsafe is any liquid or air and also if there's no
    * space
    * 
    * @param l
    *            - Location to be checked
    * @return true if safe, otherwise false
    */
   public static boolean isSafeLocation(final Location l) {
if (l == null) {
    return false;
}
// TODO: improve the safe location finding.
//Bukkit.getLogger().info("DEBUG: " + l.toString());
final Block ground = l.getBlock().getRelative(BlockFace.DOWN);
final Block space1 = l.getBlock();
final Block space2 = l.getBlock().getRelative(BlockFace.UP);
//Bukkit.getLogger().info("DEBUG: ground = " + ground.getType());
//Bukkit.getLogger().info("DEBUG: space 1 = " + space1.getType());
//Bukkit.getLogger().info("DEBUG: space 2 = " + space2.getType());
// Portals are not "safe"
if (space1.getType() == Material.PORTAL || ground.getType() == Material.PORTAL || space2.getType() == Material.PORTAL
    || space1.getType() == Material.ENDER_PORTAL || ground.getType() == Material.ENDER_PORTAL || space2.getType() == Material.ENDER_PORTAL) {
    return false;
}
// If ground is AIR, then this is either not good, or they are on slab,
// stair, etc.
if (ground.getType() == Material.AIR) {
    // Bukkit.getLogger().info("DEBUG: air");
    return false;
}
// In aSkyblock, liquid may be unsafe
if (ground.isLiquid() || space1.isLiquid() || space2.isLiquid()) {
    // Check if acid has no damage
    if (ground.getType().equals(Material.STATIONARY_LAVA) || ground.getType().equals(Material.LAVA)
        || space1.getType().equals(Material.STATIONARY_LAVA) || space1.getType().equals(Material.LAVA)
        || space2.getType().equals(Material.STATIONARY_LAVA) || space2.getType().equals(Material.LAVA)) {
    // Lava check only
    // Bukkit.getLogger().info("DEBUG: lava");
    return false;
    }
}
MaterialData md = ground.getState().getData();
if (md instanceof SimpleAttachableMaterialData) {
    //Bukkit.getLogger().info("DEBUG: trapdoor/button/tripwire hook etc.");
    if (md instanceof TrapDoor) {
    TrapDoor trapDoor = (TrapDoor)md;
    if (trapDoor.isOpen()) {
        //Bukkit.getLogger().info("DEBUG: trapdoor open");
        return false;
    }
    } else {
    return false;
    }
    //Bukkit.getLogger().info("DEBUG: trapdoor closed");
}
if (ground.getType().equals(Material.CACTUS) || ground.getType().equals(Material.BOAT) || ground.getType().equals(Material.FENCE)
    || ground.getType().equals(Material.NETHER_FENCE) || ground.getType().equals(Material.SIGN_POST) || ground.getType().equals(Material.WALL_SIGN)) {
    // Bukkit.getLogger().info("DEBUG: cactus");
    return false;
}
// Check that the space is not solid
// The isSolid function is not fully accurate (yet) so we have to
// check
// a few other items
// isSolid thinks that PLATEs and SIGNS are solid, but they are not
if (space1.getType().isSolid() && !space1.getType().equals(Material.SIGN_POST) && !space1.getType().equals(Material.WALL_SIGN)) {
    return false;
}
if (space2.getType().isSolid()&& !space2.getType().equals(Material.SIGN_POST) && !space2.getType().equals(Material.WALL_SIGN)) {
    return false;
}
// Safe
//Bukkit.getLogger().info("DEBUG: safe!");
return true;
   }
项目:acidisland    文件:GridManager.java   
/**
 * Checks if this location is safe for a player to teleport to. Used by
 * warps and boat exits Unsafe is any liquid or air and also if there's no
 * space
 * 
 * @param l
 *            - Location to be checked
 * @return true if safe, otherwise false
 */
public static boolean isSafeLocation(final Location l) {
    if (l == null) {
        return false;
    }
    // TODO: improve the safe location finding.
    //Bukkit.getLogger().info("DEBUG: " + l.toString());
    final Block ground = l.getBlock().getRelative(BlockFace.DOWN);
    final Block space1 = l.getBlock();
    final Block space2 = l.getBlock().getRelative(BlockFace.UP);
    //Bukkit.getLogger().info("DEBUG: ground = " + ground.getType());
    //Bukkit.getLogger().info("DEBUG: space 1 = " + space1.getType());
    //Bukkit.getLogger().info("DEBUG: space 2 = " + space2.getType());
    // Portals are not "safe"
    if (space1.getType() == Material.PORTAL || ground.getType() == Material.PORTAL || space2.getType() == Material.PORTAL
            || space1.getType() == Material.ENDER_PORTAL || ground.getType() == Material.ENDER_PORTAL || space2.getType() == Material.ENDER_PORTAL) {
        return false;
    }
    // If ground is AIR, then this is either not good, or they are on slab,
    // stair, etc.
    if (ground.getType() == Material.AIR) {
        // Bukkit.getLogger().info("DEBUG: air");
        return false;
    }
    // In ASkyBlock, liquid may be unsafe
    if (ground.isLiquid() || space1.isLiquid() || space2.isLiquid()) {
        // Check if acid has no damage
        if (Settings.acidDamage > 0D) {
            // Bukkit.getLogger().info("DEBUG: acid");
            return false;
        } else if (ground.getType().equals(Material.STATIONARY_LAVA) || ground.getType().equals(Material.LAVA)
                || space1.getType().equals(Material.STATIONARY_LAVA) || space1.getType().equals(Material.LAVA)
                || space2.getType().equals(Material.STATIONARY_LAVA) || space2.getType().equals(Material.LAVA)) {
            // Lava check only
            // Bukkit.getLogger().info("DEBUG: lava");
            return false;
        }
    }
    MaterialData md = ground.getState().getData();
    if (md instanceof SimpleAttachableMaterialData) {
        //Bukkit.getLogger().info("DEBUG: trapdoor/button/tripwire hook etc.");
        if (md instanceof TrapDoor) {
            TrapDoor trapDoor = (TrapDoor)md;
            if (trapDoor.isOpen()) {
                //Bukkit.getLogger().info("DEBUG: trapdoor open");
                return false;
            }
        } else {
            return false;
        }
        //Bukkit.getLogger().info("DEBUG: trapdoor closed");
    }
    if (ground.getType().equals(Material.CACTUS) || ground.getType().equals(Material.BOAT) || ground.getType().equals(Material.FENCE)
            || ground.getType().equals(Material.NETHER_FENCE) || ground.getType().equals(Material.SIGN_POST) || ground.getType().equals(Material.WALL_SIGN)) {
        // Bukkit.getLogger().info("DEBUG: cactus");
        return false;
    }
    // Check that the space is not solid
    // The isSolid function is not fully accurate (yet) so we have to
    // check
    // a few other items
    // isSolid thinks that PLATEs and SIGNS are solid, but they are not
    if (space1.getType().isSolid() && !space1.getType().equals(Material.SIGN_POST) && !space1.getType().equals(Material.WALL_SIGN)) {
        return false;
    }
    if (space2.getType().isSolid()&& !space2.getType().equals(Material.SIGN_POST) && !space2.getType().equals(Material.WALL_SIGN)) {
        return false;
    }
    // Safe
    //Bukkit.getLogger().info("DEBUG: safe!");
    return true;
}
项目:askyblock    文件:GridManager.java   
/**
 * Checks if this location is safe for a player to teleport to. Used by
 * warps and boat exits Unsafe is any liquid or air and also if there's no
 * space
 * 
 * @param l
 *            - Location to be checked
 * @return true if safe, otherwise false
 */
public static boolean isSafeLocation(final Location l) {
    if (l == null) {
        return false;
    }
    // TODO: improve the safe location finding.
    //Bukkit.getLogger().info("DEBUG: " + l.toString());
    final Block ground = l.getBlock().getRelative(BlockFace.DOWN);
    final Block space1 = l.getBlock();
    final Block space2 = l.getBlock().getRelative(BlockFace.UP);
    //Bukkit.getLogger().info("DEBUG: ground = " + ground.getType());
    //Bukkit.getLogger().info("DEBUG: space 1 = " + space1.getType());
    //Bukkit.getLogger().info("DEBUG: space 2 = " + space2.getType());
    // Portals are not "safe"
    if (space1.getType() == Material.PORTAL || ground.getType() == Material.PORTAL || space2.getType() == Material.PORTAL
            || space1.getType() == Material.ENDER_PORTAL || ground.getType() == Material.ENDER_PORTAL || space2.getType() == Material.ENDER_PORTAL) {
        return false;
    }
    // If ground is AIR, then this is either not good, or they are on slab,
    // stair, etc.
    if (ground.getType() == Material.AIR) {
        // Bukkit.getLogger().info("DEBUG: air");
        return false;
    }
    // In ASkyBlock, liquid may be unsafe
    if (ground.isLiquid() || space1.isLiquid() || space2.isLiquid()) {
        // Check if acid has no damage
        if (Settings.acidDamage > 0D) {
            // Bukkit.getLogger().info("DEBUG: acid");
            return false;
        } else if (ground.getType().equals(Material.STATIONARY_LAVA) || ground.getType().equals(Material.LAVA)
                || space1.getType().equals(Material.STATIONARY_LAVA) || space1.getType().equals(Material.LAVA)
                || space2.getType().equals(Material.STATIONARY_LAVA) || space2.getType().equals(Material.LAVA)) {
            // Lava check only
            // Bukkit.getLogger().info("DEBUG: lava");
            return false;
        }
    }
    MaterialData md = ground.getState().getData();
    if (md instanceof SimpleAttachableMaterialData) {
        //Bukkit.getLogger().info("DEBUG: trapdoor/button/tripwire hook etc.");
        if (md instanceof TrapDoor) {
            TrapDoor trapDoor = (TrapDoor)md;
            if (trapDoor.isOpen()) {
                //Bukkit.getLogger().info("DEBUG: trapdoor open");
                return false;
            }
        } else {
            return false;
        }
        //Bukkit.getLogger().info("DEBUG: trapdoor closed");
    }
    if (ground.getType().equals(Material.CACTUS) || ground.getType().equals(Material.BOAT) || ground.getType().equals(Material.FENCE)
            || ground.getType().equals(Material.NETHER_FENCE) || ground.getType().equals(Material.SIGN_POST) || ground.getType().equals(Material.WALL_SIGN)) {
        // Bukkit.getLogger().info("DEBUG: cactus");
        return false;
    }
    // Check that the space is not solid
    // The isSolid function is not fully accurate (yet) so we have to
    // check
    // a few other items
    // isSolid thinks that PLATEs and SIGNS are solid, but they are not
    if (space1.getType().isSolid() && !space1.getType().equals(Material.SIGN_POST) && !space1.getType().equals(Material.WALL_SIGN)) {
        return false;
    }
    if (space2.getType().isSolid()&& !space2.getType().equals(Material.SIGN_POST) && !space2.getType().equals(Material.WALL_SIGN)) {
        return false;
    }
    // Safe
    //Bukkit.getLogger().info("DEBUG: safe!");
    return true;
}
项目:BedrockAPI    文件:TrapDoor.java   
public TrapDoor() {
}
项目:BedrockAPI    文件:TrapDoor.java   
@Deprecated public TrapDoor(int type) {
}
项目:BedrockAPI    文件:TrapDoor.java   
public TrapDoor(Material type) {
}
项目:BedrockAPI    文件:TrapDoor.java   
@Deprecated public TrapDoor(int type, byte data) {
}
项目:BedrockAPI    文件:TrapDoor.java   
@Deprecated public TrapDoor(Material type, byte data) {
}
项目:BedrockAPI    文件:TrapDoor.java   
public TrapDoor clone() {
    return null;
}
项目:SupaCommons    文件:BlockUtils.java   
/**
 * Checks whether a door {@link Block} is closed. This method supports:
 * <br/>
 * <ul>
 * <li>{@link Material#TRAP_DOOR}</li>
 * <li>All types of two high doors</li>
 * </ul>
 *
 * <br/>
 * <b>NOTE: this doesn't actually test if the block is a door!</b>
 *
 * @param block door block to check
 *
 * @return whether the {@code block} is closed
 */
public static boolean isDoorClosed(Block block) {
  if (!isDoor(block)) {
    return false;
  }

  if (block.getType() == Material.TRAP_DOOR) {
    TrapDoor trapdoor = (TrapDoor) block.getState().getData();
    return !trapdoor.isOpen();
  } else {
    return ((getBottomDoorBlock(block).getData() & 0x4) == 0);
  }
}