diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java index b0fde947..6a28ffbb 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java @@ -346,6 +346,7 @@ public void onBlockPistonRetract(BlockPistonRetractEvent event) { Events.fireBulkEventToCancel(event, new BreakBlockEvent(event, cause, event.getBlock().getWorld(), blocks, Material.AIR)); if (originalSize != blocks.size()) { event.setCancelled(true); + return; } for (Block b : blocks) { Location loc = b.getRelative(direction).getLocation(); @@ -365,8 +366,14 @@ public void onBlockPistonRetract(BlockPistonRetractEvent event) { public void onBlockPistonExtend(BlockPistonExtendEvent event) { EventDebounce.Entry entry = pistonExtendDebounce.getIfNotPresent(new BlockPistonExtendKey(event), event); if (entry != null) { + Cause cause = create(event.getBlock()); List blocks = new ArrayList<>(event.getBlocks()); int originalLength = blocks.size(); + Events.fireBulkEventToCancel(event, new BreakBlockEvent(event, cause, event.getBlock().getWorld(), blocks, Material.AIR)); + if (originalLength != blocks.size()) { + event.setCancelled(true); + return; + } BlockFace dir = event.getDirection(); for (int i = 0; i < blocks.size(); i++) { Block existing = blocks.get(i); @@ -376,7 +383,7 @@ public void onBlockPistonExtend(BlockPistonExtendEvent event) { blocks.set(i, existing.getRelative(dir)); } } - Events.fireBulkEventToCancel(event, new PlaceBlockEvent(event, create(event.getBlock()), event.getBlock().getWorld(), blocks, Material.STONE)); + Events.fireBulkEventToCancel(event, new PlaceBlockEvent(event, cause, event.getBlock().getWorld(), blocks, Material.STONE)); if (blocks.size() != originalLength) { event.setCancelled(true); }