From 619e52a5d4a2675dd2973de13596659d2fd6af24 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Sun, 30 Sep 2012 18:01:42 -0500 Subject: [PATCH] fix for pistons not working (via pistonProtectionThroughDenyBuild) if faction doesn't have build rights in its own territory --- .../factions/listeners/FactionsBlockListener.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java index c7963954..b3563961 100644 --- a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -129,8 +129,11 @@ public class FactionsBlockListener implements Listener // target end-of-the-line empty (air) block which is being pushed into, including if piston itself would extend into air Block targetBlock = event.getBlock().getRelative(event.getDirection(), event.getLength() + 1); + // members of faction might not have build rights in their own territory, but pistons should still work regardless; so, address that corner case + Faction targetFaction = Board.getFactionAt(new FLocation(targetBlock)); + if (targetFaction == pistonFaction) return; + // if potentially pushing into air in another territory, we need to check it out - if (targetBlock.isEmpty() && ! FPerm.BUILD.has(pistonFaction, targetBlock.getLocation())) { event.setCancelled(true);