diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java index 05f02d483..36b44c56e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java @@ -800,7 +800,9 @@ import java.util.concurrent.TimeUnit; public void run() { if (this.ticked > 36_000L) { this.ticked = 0l; - sendConsoleSenderMessage(C.PREFIX.s() + "KillAllEntities has been running for 60 minutes. Errors: " + this.error); + if (this.error > 0) { + sendConsoleSenderMessage(C.PREFIX.s() + "KillAllEntities has been running for 6 hours. Errors: " + this.error); + } this.error = 0l; } World world; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java index 22ad7ccdf..bfc4ae702 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java @@ -51,7 +51,11 @@ import java.util.UUID; return true; } final Plot plot = PlayerFunctions.getCurrentPlot(plr); - if (((plot.owner == null) || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotMain.hasPermission(plr, "plots.admin")) { + if ((plot == null) || !plot.hasOwner()) { + PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); + return false; + } + if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !PlotMain.hasPermission(plr, "plots.admin")) { PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return true; } @@ -68,7 +72,7 @@ import java.util.UUID; return false; } if (!plot.denied.contains(uuid)) { - if (plot.owner == uuid) { + if (plot.owner.equals(uuid)) { PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); return false; } @@ -86,7 +90,7 @@ import java.util.UUID; DBFunc.removeHelper(plr.getWorld().getName(), plot, player); } plot.addDenied(uuid); - DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); + DBFunc.setDenied(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid)); final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true); Bukkit.getPluginManager().callEvent(event); } else { @@ -111,13 +115,13 @@ import java.util.UUID; return true; } plot.removeDenied(uuid); - DBFunc.removeDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); + DBFunc.removeDenied(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid)); PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED); return true; } final UUID uuid = UUIDHandler.getUUID(args[1]); plot.removeDenied(uuid); - DBFunc.removeDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); + DBFunc.removeDenied(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid)); final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false); Bukkit.getPluginManager().callEvent(event); PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java index 882fc85af..607c7c79d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java @@ -51,7 +51,11 @@ import java.util.UUID; return true; } final Plot plot = PlayerFunctions.getCurrentPlot(plr); - if (((plot.owner == null) || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotMain.hasPermission(plr, "plots.admin")) { + if ((plot == null) || !plot.hasOwner()) { + PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); + return false; + } + if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !PlotMain.hasPermission(plr, "plots.admin")) { PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return true; } @@ -67,7 +71,7 @@ import java.util.UUID; return false; } if (!plot.helpers.contains(uuid)) { - if (plot.owner == uuid) { + if (plot.owner.equals(uuid)) { PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); return false; } @@ -85,7 +89,7 @@ import java.util.UUID; DBFunc.removeDenied(plr.getWorld().getName(), plot, player); } plot.addHelper(uuid); - DBFunc.setHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); + DBFunc.setHelper(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid)); final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true); Bukkit.getPluginManager().callEvent(event); } else { @@ -102,13 +106,13 @@ import java.util.UUID; return true; } plot.removeHelper(uuid); - DBFunc.removeHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); + DBFunc.removeHelper(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid)); PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED); return true; } final UUID uuid = UUIDHandler.getUUID(args[1]); plot.removeHelper(uuid); - DBFunc.removeHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); + DBFunc.removeHelper(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid)); final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false); Bukkit.getPluginManager().callEvent(event); PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java index b96d2bf3c..c065c3adf 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -139,7 +139,7 @@ public class Merge extends SubCommand { PlotId top2 = PlayerFunctions.getTopPlot(world, PlotHelper.getPlot(world, botId)).id; bot = new PlotId(Math.min(bot1.x, bot2.x), Math.min(bot1.y, bot2.y)); - top = new PlotId(Math.min(top1.x, top2.x), Math.min(top1.y, top2.y)); + top = new PlotId(Math.max(top1.x, top2.x), Math.max(top1.y, top2.y)); plots = PlayerFunctions.getMaxPlotSelectionIds(world, bot, top); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java index d2fe2af03..2f312aebe 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java @@ -51,7 +51,11 @@ import java.util.UUID; return true; } final Plot plot = PlayerFunctions.getCurrentPlot(plr); - if (((plot.owner == null) || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotMain.hasPermission(plr, "plots.admin")) { + if ((plot == null) || !plot.hasOwner()) { + PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); + return false; + } + if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !PlotMain.hasPermission(plr, "plots.admin")) { PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return true; } @@ -68,7 +72,7 @@ import java.util.UUID; return false; } if (!plot.trusted.contains(uuid)) { - if (plot.owner == uuid) { + if (plot.owner.equals(uuid)) { PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); return false; } @@ -86,7 +90,7 @@ import java.util.UUID; DBFunc.removeDenied(plr.getWorld().getName(), plot, player); } plot.addTrusted(uuid); - DBFunc.setTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); + DBFunc.setTrusted(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid)); final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true); Bukkit.getPluginManager().callEvent(event); } else { @@ -103,13 +107,13 @@ import java.util.UUID; return true; } plot.removeTrusted(uuid); - DBFunc.removeTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); + DBFunc.removeTrusted(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid)); PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED); return true; } final UUID uuid = UUIDHandler.getUUID(args[1]); plot.removeTrusted(uuid); - DBFunc.removeTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); + DBFunc.removeTrusted(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid)); final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false); Bukkit.getPluginManager().callEvent(event); PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java index 97dae4179..ea3c313db 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java @@ -166,15 +166,17 @@ import java.util.UUID; plot2.settings.setMerged(0, true); } } - if (changed) { - result = true; - DBFunc.setMerged(world.getName(), plot, plot.settings.getMerged()); - if (plot2 != null) { - DBFunc.setMerged(world.getName(), plot2, plot2.settings.getMerged()); - } - } } } + + for (int x = pos1.x; x <= pos2.x; x++) { + for (int y = pos1.y; y <= pos2.y; y++) { + final PlotId id = new PlotId(x, y); + final Plot plot = PlotMain.getPlots(world).get(id); + DBFunc.setMerged(world.getName(), plot, plot.settings.getMerged()); + } + } + manager.finishPlotMerge(world, plotworld, plotIds);