Fix for pistons being able to push blocks into protected territory through water or lava

This commit is contained in:
Brettflan 2012-11-11 13:05:58 -06:00
parent 1c8d6919bd
commit 9c7ed3bf38

View File

@ -133,8 +133,8 @@ public class FactionsBlockListener implements Listener
Faction targetFaction = Board.getFactionAt(new FLocation(targetBlock)); Faction targetFaction = Board.getFactionAt(new FLocation(targetBlock));
if (targetFaction == pistonFaction) return; if (targetFaction == pistonFaction) return;
// if potentially pushing into air in another territory, we need to check it out // if potentially pushing into air/water/lava in another territory, we need to check it out
if (targetBlock.isEmpty() && ! FPerm.BUILD.has(pistonFaction, targetBlock.getLocation())) if ((targetBlock.isEmpty() || targetBlock.isLiquid()) && ! FPerm.BUILD.has(pistonFaction, targetBlock.getLocation()))
{ {
event.setCancelled(true); event.setCancelled(true);
} }
@ -154,8 +154,8 @@ public class FactionsBlockListener implements Listener
Location targetLoc = event.getRetractLocation(); Location targetLoc = event.getRetractLocation();
// if potentially retracted block is just air, no worries // if potentially retracted block is just air/water/lava, no worries
if (targetLoc.getBlock().isEmpty()) return; if (targetLoc.getBlock().isEmpty() || targetLoc.getBlock().isLiquid()) return;
Faction pistonFaction = Board.getFactionAt(new FLocation(event.getBlock())); Faction pistonFaction = Board.getFactionAt(new FLocation(event.getBlock()));