From 1dd0b5de5f53b9c433896b8ad90c0c69b6778b68 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Mon, 6 Oct 2014 22:42:49 +1100 Subject: [PATCH] Fixed --- .../intellectualcrafters/plot/PlotHelper.java | 14 +++++++------ .../plot/commands/Command.java | 2 +- .../plot/commands/Delete.java | 2 +- .../plot/commands/Denied.java | 21 ++++++++++++------- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java index 9f8cdb862..8907d2954 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java @@ -423,7 +423,7 @@ public class PlotHelper { public static boolean createPlot(Player player, Plot plot) { @SuppressWarnings("deprecation") World w = plot.getWorld(); - Plot p = new Plot(plot.id, player.getUniqueId(), plot.settings.getBiome(), null, null, w.getName()); + Plot p = new Plot(plot.id, player.getUniqueId(), plot.settings.getBiome(), new ArrayList(), new ArrayList(), w.getName()); PlotMain.updatePlot(p); DBFunc.createPlot(p); DBFunc.createPlotSettings(DBFunc.getId(w.getName(), p.id), p); @@ -824,10 +824,12 @@ public class PlotHelper { int startZ = (pos1.getBlockZ() / 16) * 16; int chunkX = 16 + pos2.getBlockX(); int chunkZ = 16 + pos2.getBlockZ(); - int plotMinX = getPlotBottomLoc(world, plot.id).getBlockX() + 1; - int plotMinZ = getPlotBottomLoc(world, plot.id).getBlockZ() + 1; - int plotMaxX = getPlotTopLoc(world, plot.id).getBlockX(); - int plotMaxZ = getPlotTopLoc(world, plot.id).getBlockZ(); + Location l1 = getPlotBottomLoc(world, plot.id); + Location l2 = getPlotTopLoc(world, plot.id); + int plotMinX = l1.getBlockX() + 1; + int plotMinZ = l1.getBlockZ() + 1; + int plotMaxX = l2.getBlockX(); + int plotMaxZ = l2.getBlockZ(); Location min = null; Location max = null; for (int i = startX; i < chunkX; i += 16) { @@ -878,7 +880,7 @@ public class PlotHelper { if (max.getBlockX() > plotMaxX) { max.setX(plotMaxX); } - if (max.getBlockX() > plotMaxZ) { + if (max.getBlockZ() > plotMaxZ) { max.setZ(plotMaxZ); } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Command.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Command.java index d2c35774f..2825aa047 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Command.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Command.java @@ -65,7 +65,7 @@ public enum Command { /** * */ - DELETE("delete", "d", new CommandPermission("plots.clear.delete")), + DELETE("delete", "d", new CommandPermission("plots.delete")), /** * */ diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java index 790b71f5a..685a14596 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java @@ -38,7 +38,7 @@ public class Delete extends SubCommand { PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED); return false; } - if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) { + if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId()))) && !plr.hasPermission("plots.admin")) { PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return false; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Denied.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Denied.java index 590ffd861..16f134c87 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Denied.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Denied.java @@ -31,10 +31,9 @@ public class Denied extends SubCommand { super(Command.DENIED, "Manage plot helpers", "denied {add|remove} {player}", CommandCategory.ACTIONS); } - @SuppressWarnings("deprecated") private boolean hasBeenOnServer(String name) { - Player plr; - if ((plr = Bukkit.getPlayer(name)) == null) { + Player plr = Bukkit.getPlayerExact(name); + if (plr == null) { OfflinePlayer oplr = Bukkit.getOfflinePlayer(name); if (oplr == null) { return false; @@ -78,11 +77,15 @@ public class Denied extends SubCommand { return true; } UUID uuid = null; - if ((Bukkit.getPlayer(args[1]) != null) && Bukkit.getPlayer(args[1]).isOnline()) { - uuid = Bukkit.getPlayer(args[1]).getUniqueId(); + if ((Bukkit.getPlayerExact(args[1]) != null)) { + uuid = Bukkit.getPlayerExact(args[1]).getUniqueId(); } else { uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId(); } + if (uuid == null) { + PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON); + return true; + } plot.addDenied(uuid); DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true); @@ -112,8 +115,8 @@ public class Denied extends SubCommand { return true; } UUID uuid = null; - if (Bukkit.getPlayer(args[1]).isOnline()) { - uuid = Bukkit.getPlayer(args[1]).getUniqueId(); + if (Bukkit.getPlayerExact(args[1])!=null) { + uuid = Bukkit.getPlayerExact(args[1]).getUniqueId(); } else { uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId(); } @@ -121,6 +124,10 @@ public class Denied extends SubCommand { PlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED); return true; } + if (uuid == null) { + PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON); + return true; + } plot.removeDenied(uuid); DBFunc.removeDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false);