From f7810860da67e333aa4c61b355ceb373ea181fd6 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Thu, 7 Apr 2016 02:14:50 +1000 Subject: [PATCH 1/4] Re-add WorldEdit check --- .../bukkit/util/block/FastQueue_1_8_3.java | 12 ------------ .../bukkit/util/block/FastQueue_1_9.java | 12 ------------ .../java/com/intellectualcrafters/plot/PS.java | 14 ++++++++++---- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java index 719819955..ff2bf42fe 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java @@ -13,7 +13,6 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod.RefExecutor; import com.intellectualcrafters.plot.util.SetQueue; import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper; import com.intellectualcrafters.plot.util.TaskManager; -import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.SendChunk; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -261,17 +260,6 @@ public class FastQueue_1_8_3 extends SlowQueue { return new FastChunk_1_8_3(wrap); } - @Override - public void regenerateChunk(String worldname, ChunkLoc loc) { - World world = BukkitUtil.getWorld(worldname); - Chunk chunk = world.getChunkAt(loc.x, loc.z); - if (chunk.getTileEntities().length > 0) { - Object w = methodGetHandleWorld.of(world).call(); - ((Collection) this.tileEntityListTick.of(w).get()).clear(); - } - super.regenerateChunk(worldname, loc); - } - /** * This should be overridden by any specialized queues * @param plotChunk diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_9.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_9.java index c0d7b8f06..04b3eaa91 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_9.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_9.java @@ -80,18 +80,6 @@ public class FastQueue_1_9 extends SlowQueue { MainUtil.initCache(); } - @Override - public void regenerateChunk(String worldname, ChunkLoc loc) { - World world = BukkitUtil.getWorld(worldname); - Chunk chunk = world.getChunkAt(loc.x, loc.z); - if (chunk.getTileEntities().length > 0) { - Object c = methodGetHandleChunk.of(chunk).call(); - Object w = methodGetWorld.of(c).call(); - ((Collection) this.tileEntityListTick.of(w).get()).clear(); - } - super.regenerateChunk(worldname, loc); - } - /** * This should be overridden by any specialized queues * @param plotChunk diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index dccd9cf7d..26ef93e89 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -171,10 +171,16 @@ public class PS { if (Settings.KILL_ROAD_MOBS || Settings.KILL_ROAD_VEHICLES) { this.IMP.runEntityTask(); } - if (this.IMP.initWorldEdit()) { - this.worldedit = WorldEdit.getInstance(); - WorldEdit.getInstance().getEventBus().register(new WESubscriber()); - new WE_Anywhere(); + try { + if (this.IMP.initWorldEdit()) { + this.worldedit = WorldEdit.getInstance(); + WorldEdit.getInstance().getEventBus().register(new WESubscriber()); + new WE_Anywhere(); + + } + } catch (Throwable e) { + e.printStackTrace(); + PS.debug("Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master"); } // Events From 45b695011183bf1f3df196da20d2f933569d7df7 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Thu, 7 Apr 2016 03:33:49 +1000 Subject: [PATCH 2/4] Fixes chat error / plot deny * --- .../java/com/plotsquared/bukkit/listeners/PlayerEvents.java | 5 +---- .../main/java/com/intellectualcrafters/plot/object/Plot.java | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index b856f7f85..f216d2b8d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -603,14 +603,11 @@ public class PlayerEvents extends PlotListener implements Listener { } } } - String full = format.replaceAll("%plot_id%", id.x + ";" + id.y).replaceAll("%sender%", sender).replaceAll("%msg%", message); + String full = format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender).replace("%msg%", message); full = ChatColor.translateAlternateColorCodes('&', full); -// format = format.replaceAll("%plot_id%", id.x + ";" + id.y).replaceAll("%sender%", "%s").replaceAll("%msg%", "%s"); -// format = ChatColor.translateAlternateColorCodes('&', format); for (Player receiver : recipients) { receiver.sendMessage(full); } -// event.setFormat(format); } @EventHandler(priority = EventPriority.LOWEST) 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 bafbc6e67..79130e18b 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -1635,7 +1635,7 @@ public class Plot { public boolean removeDenied(UUID uuid) { if (uuid == DBFunc.everyone) { boolean result = false; - for (UUID other : getDenied()) { + for (UUID other : new HashSet<>(getDenied())) { result = result || rmvDenied(other); } return result; @@ -1662,7 +1662,7 @@ public class Plot { public boolean removeTrusted(UUID uuid) { if (uuid == DBFunc.everyone) { boolean result = false; - for (UUID other : getTrusted()) { + for (UUID other : new HashSet<>(getTrusted())) { result = result || rmvTrusted(other); } return result; From 9ba3b06854f56d09ff615005d56d6d878fbed912 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Thu, 7 Apr 2016 20:05:02 +1000 Subject: [PATCH 3/4] change priority to low --- .../java/com/plotsquared/bukkit/listeners/PlayerEvents.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index f216d2b8d..9db361f56 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -571,7 +571,7 @@ public class PlayerEvents extends PlotListener implements Listener { } } - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onChat(AsyncPlayerChatEvent event) { PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer()); Location location = plotPlayer.getLocation(); From 588f5d7ebcc66fe482ecf1fc87ba20fd0243646b Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 9 Apr 2016 22:48:27 +1000 Subject: [PATCH 4/4] Fixes #1047 --- .../com/intellectualcrafters/plot/commands/MainCommand.java | 2 +- Core/src/main/java/com/intellectualcrafters/plot/config/C.java | 1 - .../main/java/com/intellectualcrafters/plot/util/MainUtil.java | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java index 154a214aa..e87650144 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java @@ -134,7 +134,7 @@ public class MainCommand extends Command { @Override public void run(final Command cmd, final Runnable success, final Runnable failure) { if (cmd.hasConfirmation(player) ) { - CmdConfirm.addPending(player, "/plot area create pos2 (Creates world)", new Runnable() { + CmdConfirm.addPending(player, cmd.getUsage(), new Runnable() { @Override public void run() { if (EconHandler.manager != null) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/C.java b/Core/src/main/java/com/intellectualcrafters/plot/config/C.java index a33cb177f..c3abd620e 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -290,7 +290,6 @@ public enum C { TASK_START("Starting task...", "Core"), PREFIX("$3[$1P2$3] $2", "Core"), ENABLED("$1PlotSquared is now enabled", "Core"), - EXAMPLE_MESSAGE("$2This is an example message &k!!!", "Core"), /* * Reload */ 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 d494b8cdd..f3774963f 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -721,7 +721,7 @@ public class MainUtil { expires = String.format("%d days", TimeUnit.MILLISECONDS.toDays(l)); } } - } else { + } else if (ExpireManager.IMP != null) { long timestamp = ExpireManager.IMP.getTimestamp(plot.owner); long compared = System.currentTimeMillis() - timestamp; long l = Settings.AUTO_CLEAR_DAYS - TimeUnit.MILLISECONDS.toDays(compared);