From 4319300b34a9eb368eb198c8d47dc4aa411fb145 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 17 Jun 2016 13:46:13 +1000 Subject: [PATCH] Fixes #1126 --- .../plot/flag/FlagManager.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java b/Core/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java index 97c5eb99b..41ca264ab 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java @@ -217,18 +217,22 @@ public class FlagManager { * @param id the flag to remove * @return true if the plot contained the flag and was removed successfully */ - public static boolean removePlotFlag(Plot plot, Flag id) { - Object value = plot.getFlags().remove(id); - if (value == null) { - return false; + public static boolean removePlotFlag(Plot origin, Flag id) { + for (Plot plot : origin.getConnectedPlots()) { + Object value = plot.getFlags().remove(id); + if (value == null) { + return false; + } + if (plot == origin) { + boolean result = EventUtil.manager.callFlagRemove(id, plot, value); + if (!result) { + plot.getFlags().put(id, value); + return false; + } + } + plot.reEnter(); + DBFunc.setFlags(plot, plot.getFlags()); } - boolean result = EventUtil.manager.callFlagRemove(id, plot, value); - if (!result) { - plot.getFlags().put(id, value); - return false; - } - plot.reEnter(); - DBFunc.setFlags(plot, plot.getFlags()); return true; }