From 5acd9c5143b61dacb898490dc2f23603ff82ae10 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Fri, 28 Aug 2015 09:50:44 +1000 Subject: [PATCH] Download requires done --- .../com/intellectualcrafters/plot/commands/Continue.java | 4 ++-- .../java/com/intellectualcrafters/plot/commands/Done.java | 1 + .../com/intellectualcrafters/plot/commands/Download.java | 3 ++- .../com/intellectualcrafters/plot/config/Settings.java | 1 + .../bukkit/listeners/worldedit/WESubscriber.java | 7 ++++--- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Continue.java b/src/main/java/com/intellectualcrafters/plot/commands/Continue.java index 392425eda..51154579a 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Continue.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Continue.java @@ -60,8 +60,8 @@ public class Continue extends SubCommand { MainUtil.sendMessage(plr, C.DONE_NOT_DONE); return false; } - if (FlagManager.isPlotFlagTrue(plot, "done" ) && (!Permissions.hasPermission(plr, "plots.continue") || (Settings.DONE_COUNTS_TOWARDS_LIMIT && MainUtil.getAllowedPlots(plr) >= MainUtil.getPlayerPlotCount(plr)))) { - MainUtil.sendMessage(plr, C.DONE_ALREADY_DONE); + if (Settings.DONE_COUNTS_TOWARDS_LIMIT && MainUtil.getAllowedPlots(plr) >= MainUtil.getPlayerPlotCount(plr)) { + MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.continue"); return false; } if (MainUtil.runners.containsKey(plot)) { diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Done.java b/src/main/java/com/intellectualcrafters/plot/commands/Done.java index 1e2e7abfb..42ea960bd 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Done.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Done.java @@ -66,6 +66,7 @@ public class Done extends SubCommand { return false; } MainUtil.runners.put(plot, 1); + MainUtil.sendMessage(plr, C.GENERATING_LINK); HybridUtils.manager.analyzePlot(plot, new RunnableVal() { @Override public void run() { diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Download.java b/src/main/java/com/intellectualcrafters/plot/commands/Download.java index 9255cb5d5..fcd16bdbe 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Download.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Download.java @@ -6,6 +6,7 @@ import com.intellectualcrafters.jnbt.CompoundTag; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; +import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.RunnableVal; @@ -44,7 +45,7 @@ public class Download extends SubCommand { MainUtil.sendMessage(plr, C.PLOT_UNOWNED); return false; } - if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.download")) { + if ((!plot.isOwner(plr.getUUID()) || (Settings.DOWNLOAD_REQUIRES_DONE && FlagManager.getPlotFlag(plot, "done") != null)) && !Permissions.hasPermission(plr, "plots.admin.command.download")) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return false; } diff --git a/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/src/main/java/com/intellectualcrafters/plot/config/Settings.java index 10d27a846..d252b7fbf 100644 --- a/src/main/java/com/intellectualcrafters/plot/config/Settings.java +++ b/src/main/java/com/intellectualcrafters/plot/config/Settings.java @@ -46,6 +46,7 @@ public class Settings { */ public static String WEB_URL = "http://empcraft.com/plots/"; public static String WEB_IP = "your.ip.here"; + public static boolean DOWNLOAD_REQUIRES_DONE = false; /** * Ratings */ 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 a6284affa..2aedd13df 100644 --- a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WESubscriber.java +++ b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WESubscriber.java @@ -82,7 +82,7 @@ public class WESubscriber { reorder = (MultiStageReorder) tmp; } if (hasMask && tmp instanceof MaskingExtent) { - maskextent = tmp; + maskextent = (MaskingExtent) tmp; } extent = tmp; } @@ -103,13 +103,14 @@ public class WESubscriber { event.setExtent(new ExtentWrapper(extent)); } else { + ExtentWrapper wrapper; if (maskextent != null) { - ExtentWrapper wrapper = new ExtentWrapper(maskextent); + wrapper = new ExtentWrapper(maskextent); field.set(maskextent, history); event.setExtent(wrapper); } else { - ExtentWrapper wrapper = new ExtentWrapper(history); + wrapper = new ExtentWrapper(history); event.setExtent(wrapper); } field.set(history, reorder);