From 6671fd7e6d9d79d6c45eb48d958436afaa490e44 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Tue, 1 Sep 2015 09:55:14 +1000 Subject: [PATCH] Fixes #582 --- .../plot/commands/Clear.java | 2 +- .../database/plotme/LikePlotMeConverter.java | 32 +++++++++++++++---- .../listeners/worldedit/WESubscriber.java | 4 --- .../plotsquared/bukkit/util/SendChunk.java | 2 +- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/src/main/java/com/intellectualcrafters/plot/commands/Clear.java index 1828507e9..c6466995b 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Clear.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Clear.java @@ -88,7 +88,7 @@ public class Clear extends SubCommand { MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER); return false; } - if (FlagManager.isPlotFlagTrue(plot, "done" ) && (!Permissions.hasPermission(plr, "plots.continue") || (Settings.DONE_COUNTS_TOWARDS_LIMIT && MainUtil.getAllowedPlots(plr) >= MainUtil.getPlayerPlotCount(plr)))) { + if (FlagManager.getPlotFlag(plot, "done") != null && (!Permissions.hasPermission(plr, "plots.continue") || (Settings.DONE_COUNTS_TOWARDS_LIMIT && MainUtil.getAllowedPlots(plr) >= MainUtil.getPlayerPlotCount(plr)))) { MainUtil.sendMessage(plr, C.DONE_ALREADY_DONE); return false; } diff --git a/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java b/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java index eb69bbfb1..a885d6ddf 100644 --- a/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java +++ b/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java @@ -32,6 +32,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map.Entry; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.Set; import org.bukkit.Bukkit; @@ -244,15 +245,22 @@ public class LikePlotMeConverter { } sendMessage("Creating plot DB"); Thread.sleep(1000); + final AtomicBoolean done = new AtomicBoolean(false); DBFunc.createPlotsAndData(createdPlots, new Runnable() { @Override public void run() { - sendMessage("&aDatabase conversion is now complete!"); - PS.debug("&c - Stop the server"); - PS.debug("&c - Disable 'plotme-convert.enabled' and 'plotme-convert.cache-uuids' in the settings.yml"); - PS.debug("&c - Correct any generator settings that haven't copied to 'settings.yml' properly"); - PS.debug("&c - Start the server"); - PS.get().setAllPlotsRaw(DBFunc.getPlots()); + if (done.get()) { + sendMessage("&aDatabase conversion is now complete!"); + PS.debug("&c - Stop the server"); + PS.debug("&c - Disable 'plotme-convert.enabled' and 'plotme-convert.cache-uuids' in the settings.yml"); + PS.debug("&c - Correct any generator settings that haven't copied to 'settings.yml' properly"); + PS.debug("&c - Start the server"); + PS.get().setAllPlotsRaw(DBFunc.getPlots()); + } + else { + sendMessage("&cPlease wait until database conversion is complete. You will be notified with instructions when this happens!"); + done.set(true); + } } }); sendMessage("Saving configuration..."); @@ -311,7 +319,17 @@ public class LikePlotMeConverter { } catch (final Exception e) { e.printStackTrace(); } - sendMessage("&cPlease wait until database conversion is complete. You will be notified with instructions when this happens!"); + if (done.get()) { + sendMessage("&aDatabase conversion is now complete!"); + PS.debug("&c - Stop the server"); + PS.debug("&c - Disable 'plotme-convert.enabled' and 'plotme-convert.cache-uuids' in the settings.yml"); + PS.debug("&c - Correct any generator settings that haven't copied to 'settings.yml' properly"); + PS.debug("&c - Start the server"); + } + else { + sendMessage("&cPlease wait until database conversion is complete. You will be notified with instructions when this happens!"); + done.set(true); + } } }); } catch (final Exception e) { diff --git a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WESubscriber.java b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WESubscriber.java index e1f590b08..9e2814ce2 100644 --- a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WESubscriber.java +++ b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WESubscriber.java @@ -72,10 +72,6 @@ public class WESubscriber { event.setExtent(new NullExtent()); } return; - } - HeightLimitExtent heightLimit = null; - if (plotworld != null) { - } if (Settings.CHUNK_PROCESSOR) { if (Settings.EXPERIMENTAL_FAST_ASYNC_WORLDEDIT) { diff --git a/src/main/java/com/plotsquared/bukkit/util/SendChunk.java b/src/main/java/com/plotsquared/bukkit/util/SendChunk.java index 9f2d7349a..c34605307 100644 --- a/src/main/java/com/plotsquared/bukkit/util/SendChunk.java +++ b/src/main/java/com/plotsquared/bukkit/util/SendChunk.java @@ -124,7 +124,7 @@ public class SendChunk { @Override public void run() { try { - chunk.unload(true, true); + chunk.unload(true, false); } catch (Exception e) { String worldname = chunk.getWorld().getName();