From 55fe1c74c7af098c2a72e4d5fd3fc6314f011f56 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 4 Jan 2015 15:41:00 +1100 Subject: [PATCH] Fix "Asynchronous block remove" issue --- .../intellectualcrafters/plot/PlotMain.java | 21 ++++++++++++------- .../plot/listeners/WorldEditListener.java | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java index b6988312b..05f02d483 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java @@ -544,14 +544,19 @@ import java.util.concurrent.TimeUnit; } } for (final Plot plot : toDeletePlot) { - final World worldobj = Bukkit.getWorld(world); - PlotHelper.clear(worldobj, plot, true); - PlotHelper.removeSign(worldobj, plot); - DBFunc.delete(world, plot); - removePlot(world, plot.id, true); - if ((Math.abs(plot.id.x) < Math.abs(Auto.lastPlot.x)) && (Math.abs(plot.id.y) < Math.abs(Auto.lastPlot.y))) { - Auto.lastPlot = plot.id; - } + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + @Override + public void run() { + final World worldobj = Bukkit.getWorld(world); + PlotHelper.clear(worldobj, plot, true); + PlotHelper.removeSign(worldobj, plot); + DBFunc.delete(world, plot); + removePlot(world, plot.id, true); + if ((Math.abs(plot.id.x) < Math.abs(Auto.lastPlot.x)) && (Math.abs(plot.id.y) < Math.abs(Auto.lastPlot.y))) { + Auto.lastPlot = plot.id; + } + } + }); } } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java index 52ee9492b..11cb2c7d5 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java @@ -253,6 +253,7 @@ import java.util.Set; if (!isPlotWorld(q)) { if (isPlotWorld(f)) { PWE.removeMask(p); + return; } else { return; }