From a752780eeb868deee9d19ca16cfa993f0d56197c Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 14 Nov 2017 17:09:51 +1100 Subject: [PATCH] Minor fixes Update message color CME on plot action Creative middle click banner/head --- .../bukkit/listeners/PlayerEvents_1_8.java | 3 +-- .../intellectualcrafters/plot/object/Plot.java | 18 ++++++++++-------- .../plot/util/MainUtil.java | 3 +-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8.java index 3da41932e..be8a861a4 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8.java @@ -46,7 +46,7 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener { Player player = (Player) entity; PlayerInventory inv = player.getInventory(); int slot = inv.getHeldItemSlot(); - if ((slot != event.getSlot()) || (slot > 8) || !event.getEventName().equals("InventoryCreativeEvent")) { + if ((slot > 8) || !event.getEventName().equals("InventoryCreativeEvent")) { return; } ItemStack current = inv.getItemInHand(); @@ -95,7 +95,6 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener { default: return; } - return; } Location l = BukkitUtil.getLocation(state.getLocation()); PlotArea area = l.getPlotArea(); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java index 7a17edcb8..e67a98ce3 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -2304,10 +2304,11 @@ public class Plot { return connected_cache; } regions_cache = null; - connected_cache = new HashSet<>(); + + HashSet tmpSet = new HashSet<>(); ArrayDeque frontier = new ArrayDeque<>(); HashSet queuecache = new HashSet<>(); - connected_cache.add(this); + tmpSet.add(this); Plot tmp; if (merged[0]) { tmp = this.area.getPlotAbs(this.id.getRelative(0)); @@ -2381,39 +2382,40 @@ public class Plot { PS.debug("Ignoring invalid merged plot: " + current + " | " + current.owner); continue; } - connected_cache.add(current); + tmpSet.add(current); queuecache.remove(current); merged = current.getMerged(); if (merged[0]) { tmp = current.area.getPlotAbs(current.id.getRelative(0)); - if (tmp != null && !queuecache.contains(tmp) && !connected_cache.contains(tmp)) { + if (tmp != null && !queuecache.contains(tmp) && !tmpSet.contains(tmp)) { queuecache.add(tmp); frontier.add(tmp); } } if (merged[1]) { tmp = current.area.getPlotAbs(current.id.getRelative(1)); - if (tmp != null && !queuecache.contains(tmp) && !connected_cache.contains(tmp)) { + if (tmp != null && !queuecache.contains(tmp) && !tmpSet.contains(tmp)) { queuecache.add(tmp); frontier.add(tmp); } } if (merged[2]) { tmp = current.area.getPlotAbs(current.id.getRelative(2)); - if (tmp != null && !queuecache.contains(tmp) && !connected_cache.contains(tmp)) { + if (tmp != null && !queuecache.contains(tmp) && !tmpSet.contains(tmp)) { queuecache.add(tmp); frontier.add(tmp); } } if (merged[3]) { tmp = current.area.getPlotAbs(current.id.getRelative(3)); - if (tmp != null && !queuecache.contains(tmp) && !connected_cache.contains(tmp)) { + if (tmp != null && !queuecache.contains(tmp) && !tmpSet.contains(tmp)) { queuecache.add(tmp); frontier.add(tmp); } } } - return connected_cache; + connected_cache = tmpSet; + return tmpSet; } /** diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/Core/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index eb9129196..a2f8fd7a3 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -18,7 +18,6 @@ import com.intellectualcrafters.plot.object.RegionWrapper; import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.object.stream.AbstractDelegateOutputStream; import com.intellectualcrafters.plot.util.expiry.ExpireManager; - import java.io.File; import java.io.IOException; import java.io.OutputStream; @@ -115,7 +114,7 @@ public class MainUtil { public static void sendAdmin(final String s) { for (final PlotPlayer player : UUIDHandler.getPlayers().values()) { if (player.hasPermission(C.PERMISSION_ADMIN.s())) { - player.sendMessage(s); + player.sendMessage(C.color(s)); } } PS.debug(s);