From a205156ba3b599298618e04e419ed87f8c08749e Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sat, 11 Apr 2015 22:05:15 +1000 Subject: [PATCH] Fixes #265 --- .../plot/commands/Denied.java | 13 +++++++++---- .../plot/commands/Helpers.java | 13 +++++++++---- .../plot/commands/Trusted.java | 15 ++++++++++----- 3 files changed, 28 insertions(+), 13 deletions(-) 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 5b0bce5d5..4cca27500 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java @@ -100,17 +100,22 @@ public class Denied extends SubCommand { return true; } else if (args[0].equalsIgnoreCase("remove")) { if (args[1].equalsIgnoreCase("*")) { - final UUID uuid = DBFunc.everyone; - if (!plot.denied.contains(uuid)) { + if (plot.denied.size() == 0) { MainUtil.sendMessage(plr, C.WAS_NOT_ADDED); return true; } - plot.removeDenied(uuid); - DBFunc.removeDenied(loc.getWorld(), plot, uuid); + for (UUID uuid : plot.denied) { + plot.removeDenied(uuid); + DBFunc.removeDenied(loc.getWorld(), plot, uuid); + } MainUtil.sendMessage(plr, C.DENIED_REMOVED); return true; } final UUID uuid = UUIDHandler.getUUID(args[1]); + if (!plot.denied.contains(uuid)) { + MainUtil.sendMessage(plr, C.WAS_NOT_ADDED); + return true; + } plot.removeDenied(uuid); DBFunc.removeDenied(loc.getWorld(), plot, uuid); EventUtil.manager.callDenied(plr, plot, uuid, false); 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 b1d5c880d..93d81cab2 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java @@ -91,17 +91,22 @@ public class Helpers extends SubCommand { return true; } else if (args[0].equalsIgnoreCase("remove")) { if (args[1].equalsIgnoreCase("*")) { - final UUID uuid = DBFunc.everyone; - if (!plot.helpers.contains(uuid)) { + if (plot.helpers.size() == 0) { MainUtil.sendMessage(plr, C.WAS_NOT_ADDED); return true; } - plot.removeHelper(uuid); - DBFunc.removeHelper(loc.getWorld(), plot, uuid); + for (UUID uuid : plot.helpers) { + plot.removeHelper(uuid); + DBFunc.removeHelper(loc.getWorld(), plot, uuid); + } MainUtil.sendMessage(plr, C.HELPER_REMOVED); return true; } final UUID uuid = UUIDHandler.getUUID(args[1]); + if (!plot.helpers.contains(uuid)) { + MainUtil.sendMessage(plr, C.WAS_NOT_ADDED); + return false; + } plot.removeHelper(uuid); DBFunc.removeHelper(loc.getWorld(), plot, uuid); EventUtil.manager.callHelper(plr, plot, uuid, false); 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 04a6f78e6..b4a181d0e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java @@ -92,17 +92,22 @@ public class Trusted extends SubCommand { return true; } else if (args[0].equalsIgnoreCase("remove")) { if (args[1].equalsIgnoreCase("*")) { - final UUID uuid = DBFunc.everyone; - if (!plot.trusted.contains(uuid)) { - MainUtil.sendMessage(plr, C.T_WAS_NOT_ADDED); + if (plot.trusted.size() == 0) { + MainUtil.sendMessage(plr, C.WAS_NOT_ADDED); return true; } - plot.removeTrusted(uuid); - DBFunc.removeTrusted(loc.getWorld(), plot, uuid); + for (UUID uuid : plot.trusted) { + plot.removeTrusted(uuid); + DBFunc.removeTrusted(loc.getWorld(), plot, uuid); + } MainUtil.sendMessage(plr, C.TRUSTED_REMOVED); return true; } final UUID uuid = UUIDHandler.getUUID(args[1]); + if (!plot.trusted.contains(uuid)) { + MainUtil.sendMessage(plr, C.T_WAS_NOT_ADDED); + return true; + } plot.removeTrusted(uuid); DBFunc.removeTrusted(loc.getWorld(), plot, uuid); EventUtil.manager.callTrusted(plr, plot, uuid, false);