mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-09-27 04:12:40 +02:00
Prevent headless pistons deleting walls
This commit is contained in:
parent
4d4d2ab087
commit
a9f68eb351
@ -890,6 +890,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);
|
||||
@ -913,6 +920,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)
|
||||
|
Loading…
Reference in New Issue
Block a user