Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private boolean isObsidianDoor(Block b)
- {
- Block up = b.getRelative(BlockFace.UP);
- Block down = b.getRelative(BlockFace.DOWN);
- Block east = b.getRelative(BlockFace.EAST);
- Block west = b.getRelative(BlockFace.WEST);
- Block north = b.getRelative(BlockFace.NORTH);
- Block south = b.getRelative(BlockFace.SOUTH);
- if (up.getType() == Material.IRON_DOOR_BLOCK)
- {
- Block otherWest = up.getRelative(BlockFace.WEST);
- Block otherEast = up.getRelative(BlockFace.EAST);
- Block otherNorth = up.getRelative(BlockFace.NORTH);
- Block otherSouth = up.getRelative(BlockFace.SOUTH);
- up = up.getRelative(BlockFace.UP);
- }
- else if (down.getType() == Material.IRON_DOOR_BLOCK)
- {
- Block otherWest = down.getRelative(BlockFace.WEST);
- Block otherEast = down.getRelative(BlockFace.EAST);
- Block otherNorth = down.getRelative(BlockFace.NORTH);
- Block otherSouth = down.getRelative(BlockFace.SOUTH);
- down = down.getRelative(BlockFace.DOWN);
- }
- else
- {
- return false;
- }
- Block otherSouth;
- Block otherNorth;
- Block otherEast;
- Block otherWest;
- if ((up.getTypeId() == 49) && (down.getTypeId() == 49) &&
- (east.getTypeId() == 49) && (west.getTypeId() == 49) &&
- (otherWest.getTypeId() == 49) && (otherEast.getTypeId() == 49)) {
- return true;
- }
- if ((up.getTypeId() == 49) && (down.getTypeId() == 49) &&
- (north.getTypeId() == 49) && (south.getTypeId() == 49) &&
- (otherNorth.getTypeId() == 49) && (otherSouth.getTypeId() == 49)) {
- return true;
- }
- return false;
- }
- @EventHandler
- public void onEntityExplode(EntityExplodeEvent event)
- {
- List<Block> destroy = event.blockList();
- Iterator<Block> it = destroy.iterator();
- while (it.hasNext())
- {
- Block b = (Block)it.next();
- if ((b.getType() == Material.IRON_DOOR_BLOCK) &&
- (isObsidianDoor(b))) {
- it.remove();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement