From 81182dccaa01df22d3c2790a5ec2637a446167a5 Mon Sep 17 00:00:00 2001 From: drtshock Date: Sat, 8 Nov 2014 19:07:42 -0600 Subject: [PATCH] Add option to completely disable pistons in faction territory. This is a preemptive method to block new things like http://i.gyazo.com/6a1a31222e58a5d60ff341c13f6a8404.gif --- .../factions/listeners/FactionsBlockListener.java | 7 +++++++ src/main/resources/config.yml | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java index 952d1b44..e94d1001 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -98,6 +98,13 @@ public class FactionsBlockListener implements Listener { } Location targetLoc = event.getRetractLocation(); + Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(targetLoc)); + + // Check if the piston is moving in a faction's territory. This disables pistons entirely in faction territory. + if(otherFaction.isNormal() && P.p.getConfig().getBoolean("disable-pistons-in-territory", false)) { + event.setCancelled(true); + return; + } // if potentially retracted block is just air/water/lava, no worries if (targetLoc.getBlock().isEmpty() || targetLoc.getBlock().isLiquid()) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 3c98e844..56800f49 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -23,6 +23,11 @@ findfactionsexploit: # What should be the max amount of warps that a Factoin can set? max-warps: 5 +# Pistons +# Should we disable pistons in Faction territory? This will prevent people from doing something like: +# http://i.gyazo.com/6a1a31222e58a5d60ff341c13f6a8404.gif +disable-pistons-in-territory: false + # Configuration section for Scoreboards # This will allow you to completely customize how your scoreboards look. # Make sure that no lines are duplicates of each other otherwise only the first will display.