This commit is contained in:
Traks 2024-05-13 19:20:34 +00:00 committed by GitHub
commit c31f864b17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 0 deletions

View File

@ -868,6 +868,13 @@ public class BlockEventListener implements Listener {
return;
}
}
if (block.getType() == Material.MOVING_PISTON
&& event.getBlocks().isEmpty()
&& location.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ()).isPlotArea()) {
// Headless sticky pistons can delete the block in front of them
// when retracting. Prevent this.
event.setCancelled(true);
}
return;
}
Plot plot = area.getOwnedPlot(location);
@ -891,6 +898,13 @@ public class BlockEventListener implements Listener {
return;
}
}
if (block.getType() == Material.MOVING_PISTON
&& event.getBlocks().isEmpty()
&& !plot.equals(area.getOwnedPlot(location.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ())))) {
// Headless sticky pistons can delete the block in front of them
// when retracting. Prevent this.
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)