diff options
author | snowleo <schneeleo@gmail.com> | 2011-07-18 01:39:41 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-07-18 01:39:41 +0200 |
commit | f5f04b032a48e3bfc9e4d377443d7759367742f7 (patch) | |
tree | c6caf45e6505455e4d0f531554200745e5073cea /EssentialsProtect/src/com/earth2me/essentials | |
parent | d2e1b2435f39a62efec58aa4f4a829d042c1bc4f (diff) | |
download | Essentials-f5f04b032a48e3bfc9e4d377443d7759367742f7.tar Essentials-f5f04b032a48e3bfc9e4d377443d7759367742f7.tar.gz Essentials-f5f04b032a48e3bfc9e4d377443d7759367742f7.tar.lz Essentials-f5f04b032a48e3bfc9e4d377443d7759367742f7.tar.xz Essentials-f5f04b032a48e3bfc9e4d377443d7759367742f7.zip |
Protect Rails and other signs from pistons
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials')
-rw-r--r-- | EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java index de6791305..7b5f93d0e 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java @@ -336,6 +336,38 @@ public class EssentialsProtectBlockListener extends BlockListener event.setCancelled(true); return; } + if ((block.getRelative(BlockFace.UP).getType() == Material.RAILS + || block.getType() == Material.RAILS) + && prot.getSettingBool(ProtectConfig.protect_rails)) + { + event.setCancelled(true); + return; + } + if (prot.getSettingBool(ProtectConfig.protect_signs)) + { + for (BlockFace blockFace : faces) + { + if (blockFace == BlockFace.DOWN) + { + continue; + } + final Block sign = block.getRelative(blockFace); + if ((blockFace == BlockFace.UP || blockFace == BlockFace.SELF) + && sign.getType() == Material.SIGN_POST) + { + event.setCancelled(true); + return; + } + if ((blockFace == BlockFace.NORTH || blockFace == BlockFace.EAST + || blockFace == BlockFace.SOUTH || blockFace == BlockFace.WEST + || blockFace == BlockFace.SELF) + && sign.getType() == Material.WALL_SIGN) + { + event.setCancelled(true); + return; + } + } + } } } @@ -346,10 +378,43 @@ public class EssentialsProtectBlockListener extends BlockListener { return; } - if (prot.checkProtectionItems(ProtectConfig.blacklist_piston, event.getRetractLocation().getBlock().getTypeId())) + final Block block = event.getRetractLocation().getBlock(); + if (prot.checkProtectionItems(ProtectConfig.blacklist_piston, block.getTypeId())) { event.setCancelled(true); return; } + if ((block.getRelative(BlockFace.UP).getType() == Material.RAILS + || block.getType() == Material.RAILS) + && prot.getSettingBool(ProtectConfig.protect_rails)) + { + event.setCancelled(true); + return; + } + if (prot.getSettingBool(ProtectConfig.protect_signs)) + { + for (BlockFace blockFace : faces) + { + if (blockFace == BlockFace.DOWN) + { + continue; + } + final Block sign = block.getRelative(blockFace); + if ((blockFace == BlockFace.UP || blockFace == BlockFace.SELF) + && sign.getType() == Material.SIGN_POST) + { + event.setCancelled(true); + return; + } + if ((blockFace == BlockFace.NORTH || blockFace == BlockFace.EAST + || blockFace == BlockFace.SOUTH || blockFace == BlockFace.WEST + || blockFace == BlockFace.SELF) + && sign.getType() == Material.WALL_SIGN) + { + event.setCancelled(true); + return; + } + } + } } } |