summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-08-27 17:09:43 +0200
committersnowleo <schneeleo@gmail.com>2011-08-27 17:09:43 +0200
commit65be2dba9927d971066948f01e97ebbda79fe5a1 (patch)
tree4d6c6b822d1607f4838ba204c5a7327a174314da /EssentialsProtect
parent087e600d6d6d9e6192f62d25d76f541fd14740b5 (diff)
downloadEssentials-65be2dba9927d971066948f01e97ebbda79fe5a1.tar
Essentials-65be2dba9927d971066948f01e97ebbda79fe5a1.tar.gz
Essentials-65be2dba9927d971066948f01e97ebbda79fe5a1.tar.lz
Essentials-65be2dba9927d971066948f01e97ebbda79fe5a1.tar.xz
Essentials-65be2dba9927d971066948f01e97ebbda79fe5a1.zip
Protect detector/powered rails
Diffstat (limited to 'EssentialsProtect')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java32
1 files changed, 20 insertions, 12 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
index 7b5f93d0e..8717825b3 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
@@ -61,7 +61,7 @@ public class EssentialsProtectBlockListener extends BlockListener
}
final Block below = blockPlaced.getRelative(BlockFace.DOWN);
- if (below.getType() == Material.RAILS
+ if ((below.getType() == Material.RAILS || below.getType() == Material.POWERED_RAIL || below.getType() == Material.DETECTOR_RAIL)
&& prot.getSettingBool(ProtectConfig.prevent_block_on_rail)
&& prot.getStorage().isProtected(below, user.getName()))
{
@@ -70,7 +70,7 @@ public class EssentialsProtectBlockListener extends BlockListener
}
final List<Block> protect = new ArrayList<Block>();
- if (blockPlaced.getType() == Material.RAILS
+ if ((blockPlaced.getType() == Material.RAILS || blockPlaced.getType() == Material.POWERED_RAIL || blockPlaced.getType() == Material.DETECTOR_RAIL)
&& prot.getSettingBool(ProtectConfig.protect_rails)
&& user.isAuthorized("essentials.protect"))
{
@@ -103,8 +103,8 @@ public class EssentialsProtectBlockListener extends BlockListener
{
return;
}
- Block block = event.getBlock();
- if (block.getType() == Material.RAILS
+ final Block block = event.getBlock();
+ if ((block.getType() == Material.RAILS || block.getType() == Material.POWERED_RAIL || block.getType() == Material.DETECTOR_RAIL)
&& prot.getSettingBool(ProtectConfig.protect_rails))
{
event.setCancelled(true);
@@ -155,7 +155,7 @@ public class EssentialsProtectBlockListener extends BlockListener
return;
}
final Block toBlock = event.getToBlock();
- if (toBlock.getType() == Material.RAILS
+ if ((toBlock.getType() == Material.RAILS || toBlock.getType() == Material.POWERED_RAIL || toBlock.getType() == Material.DETECTOR_RAIL)
&& prot.getSettingBool(ProtectConfig.protect_rails))
{
event.setCancelled(true);
@@ -196,7 +196,7 @@ public class EssentialsProtectBlockListener extends BlockListener
return;
}
final Block block = event.getBlock();
- if (block.getType() == Material.RAILS && prot.getSettingBool(ProtectConfig.protect_rails))
+ if ((block.getType() == Material.RAILS || block.getType() == Material.POWERED_RAIL || block.getType() == Material.DETECTOR_RAIL) && prot.getSettingBool(ProtectConfig.protect_rails))
{
event.setCancelled(true);
return;
@@ -257,10 +257,10 @@ public class EssentialsProtectBlockListener extends BlockListener
if (user.isAuthorized("essentials.protect.admin"))
{
- if (type == Material.WALL_SIGN || type == Material.SIGN_POST || type == Material.RAILS)
+ if (type == Material.WALL_SIGN || type == Material.SIGN_POST || type == Material.RAILS || type == Material.POWERED_RAIL || type == Material.DETECTOR_RAIL)
{
storage.unprotectBlock(block);
- if (type == Material.RAILS || type == Material.SIGN_POST)
+ if (type == Material.RAILS || type == Material.POWERED_RAIL || type == Material.DETECTOR_RAIL || type == Material.SIGN_POST)
{
final Block below = block.getRelative(BlockFace.DOWN);
storage.unprotectBlock(below);
@@ -293,10 +293,10 @@ public class EssentialsProtectBlockListener extends BlockListener
}
else
{
- if (type == Material.WALL_SIGN || type == Material.SIGN_POST || type == Material.RAILS)
+ if (type == Material.WALL_SIGN || type == Material.SIGN_POST || type == Material.RAILS || type == Material.POWERED_RAIL || type == Material.DETECTOR_RAIL)
{
storage.unprotectBlock(block);
- if (type == Material.RAILS || type == Material.SIGN_POST)
+ if (type == Material.RAILS || type == Material.POWERED_RAIL || type == Material.DETECTOR_RAIL || type == Material.SIGN_POST)
{
final Block below = block.getRelative(BlockFace.DOWN);
storage.unprotectBlock(below);
@@ -337,7 +337,11 @@ public class EssentialsProtectBlockListener extends BlockListener
return;
}
if ((block.getRelative(BlockFace.UP).getType() == Material.RAILS
- || block.getType() == Material.RAILS)
+ || block.getType() == Material.RAILS
+ || block.getRelative(BlockFace.UP).getType() == Material.POWERED_RAIL
+ || block.getType() == Material.POWERED_RAIL
+ || block.getRelative(BlockFace.UP).getType() == Material.DETECTOR_RAIL
+ || block.getType() == Material.DETECTOR_RAIL)
&& prot.getSettingBool(ProtectConfig.protect_rails))
{
event.setCancelled(true);
@@ -385,7 +389,11 @@ public class EssentialsProtectBlockListener extends BlockListener
return;
}
if ((block.getRelative(BlockFace.UP).getType() == Material.RAILS
- || block.getType() == Material.RAILS)
+ || block.getType() == Material.RAILS
+ || block.getRelative(BlockFace.UP).getType() == Material.POWERED_RAIL
+ || block.getType() == Material.POWERED_RAIL
+ || block.getRelative(BlockFace.UP).getType() == Material.DETECTOR_RAIL
+ || block.getType() == Material.DETECTOR_RAIL)
&& prot.getSettingBool(ProtectConfig.protect_rails))
{
event.setCancelled(true);