summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect/src/com/earth2me/essentials/protect
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
commit12bf86baac5be26dc1e53b6b1a3ebbf9862b617d (patch)
tree246540094e8fd14658a754cdc000d0e92a0c7e0f /EssentialsProtect/src/com/earth2me/essentials/protect
parent08d2bd9a80f5504466305170b70ef6cdea462a45 (diff)
downloadEssentials-12bf86baac5be26dc1e53b6b1a3ebbf9862b617d.tar
Essentials-12bf86baac5be26dc1e53b6b1a3ebbf9862b617d.tar.gz
Essentials-12bf86baac5be26dc1e53b6b1a3ebbf9862b617d.tar.lz
Essentials-12bf86baac5be26dc1e53b6b1a3ebbf9862b617d.tar.xz
Essentials-12bf86baac5be26dc1e53b6b1a3ebbf9862b617d.zip
Protect detector/powered rails
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect')
-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);