summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
index 1b9736a5a..5d0a62d72 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
@@ -14,6 +14,8 @@ import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockListener;
+import org.bukkit.event.block.BlockPistonExtendEvent;
+import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockPlaceEvent;
@@ -319,4 +321,35 @@ public class EssentialsProtectBlockListener extends BlockListener
}
}
}
+
+ @Override
+ public void onBlockPistonExtend(BlockPistonExtendEvent event)
+ {
+ if (event.isCancelled())
+ {
+ return;
+ }
+ for (Block block : event.getBlocks())
+ {
+ if (prot.checkProtectionItems(ProtectConfig.blacklist_piston, block.getTypeId()))
+ {
+ event.setCancelled(true);
+ return;
+ }
+ }
+ }
+
+ @Override
+ public void onBlockPistonRetract(BlockPistonRetractEvent event)
+ {
+ if (event.isCancelled() || !event.isSticky())
+ {
+ return;
+ }
+ if (prot.checkProtectionItems(ProtectConfig.blacklist_piston, event.getRetractLocation().getBlock().getTypeId()))
+ {
+ event.setCancelled(true);
+ return;
+ }
+ }
}