diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java index 66c222d58..ae5772426 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java @@ -20,8 +20,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; -import net.milkbowl.vault.economy.Economy; - import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; @@ -32,7 +30,6 @@ import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; -import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; public class Delete extends SubCommand { @@ -58,7 +55,6 @@ public class Delete extends SubCommand { if (PlotSquared.economy != null && pWorld.USE_ECONOMY && (plot != null) && plot.hasOwner() && plot.getOwner().equals(UUIDHandler.getUUID(plr))) { final double c = pWorld.SELL_PRICE; if (c > 0d) { - final Economy economy = PlotSquared.economy; EconHandler.depositPlayer(plr, c); sendMessage(plr, C.ADDED_BALANCE, c + ""); } 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 3a29cc28b..bfca432bf 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java @@ -28,9 +28,11 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; @@ -46,11 +48,11 @@ public class Denied extends SubCommand { MainUtil.sendMessage(plr, C.DENIED_NEED_ARGUMENT); return true; } - if (!BukkitPlayerFunctions.isInPlot(plr)) { - MainUtil.sendMessage(plr, C.NOT_IN_PLOT); - return true; - } + Location loc = plr.getLocation(); final Plot plot = MainUtil.getPlot(loc); + if (plot == null) { + return !sendMessage(plr, C.NOT_IN_PLOT); + } if ((plot == null) || !plot.hasOwner()) { MainUtil.sendMessage(plr, C.PLOT_UNOWNED); return false; @@ -77,14 +79,14 @@ public class Denied extends SubCommand { } if (plot.trusted.contains(uuid)) { plot.trusted.remove(uuid); - DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid); + DBFunc.removeTrusted(loc.getWorld(), plot, uuid); } if (plot.helpers.contains(uuid)) { plot.helpers.remove(uuid); - DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid); + DBFunc.removeHelper(loc.getWorld(), plot, uuid); } plot.addDenied(uuid); - DBFunc.setDenied(plr.getWorld().getName(), plot, uuid); + DBFunc.setDenied(loc.getWorld(), plot, uuid); final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true); Bukkit.getPluginManager().callEvent(event); } else { @@ -109,13 +111,13 @@ public class Denied extends SubCommand { return true; } plot.removeDenied(uuid); - DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid); + DBFunc.removeDenied(loc.getWorld(), plot, uuid); MainUtil.sendMessage(plr, C.DENIED_REMOVED); return true; } final UUID uuid = UUIDHandler.getUUID(args[1]); plot.removeDenied(uuid); - DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid); + DBFunc.removeDenied(loc.getWorld(), plot, uuid); final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false); Bukkit.getPluginManager().callEvent(event); MainUtil.sendMessage(plr, C.DENIED_REMOVED); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java index dc6e91e3f..bc8af3d98 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java @@ -33,6 +33,7 @@ import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagValue; import com.intellectualcrafters.plot.listeners.PlotListener; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; @@ -55,6 +56,7 @@ public class FlagCmd extends SubCommand { MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.COMMAND_SYNTAX, "/plot flag "); return false; } + Location loc = player.getLocation(); final Plot plot = MainUtil.getPlot(loc); if (plot == null) { MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_IN_PLOT); 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 78c89d84f..9dbcfc490 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java @@ -75,14 +75,14 @@ public class Helpers extends SubCommand { } if (plot.trusted.contains(uuid)) { plot.trusted.remove(uuid); - DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid); + DBFunc.removeTrusted(loc.getWorld(), plot, uuid); } if (plot.denied.contains(uuid)) { plot.denied.remove(uuid); - DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid); + DBFunc.removeDenied(loc.getWorld(), plot, uuid); } plot.addHelper(uuid); - DBFunc.setHelper(plr.getWorld().getName(), plot, uuid); + DBFunc.setHelper(loc.getWorld(), plot, uuid); final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true); Bukkit.getPluginManager().callEvent(event); } else { @@ -99,13 +99,13 @@ public class Helpers extends SubCommand { return true; } plot.removeHelper(uuid); - DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid); + DBFunc.removeHelper(loc.getWorld(), plot, uuid); MainUtil.sendMessage(plr, C.HELPER_REMOVED); return true; } final UUID uuid = UUIDHandler.getUUID(args[1]); plot.removeHelper(uuid); - DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid); + DBFunc.removeHelper(loc.getWorld(), plot, uuid); final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false); Bukkit.getPluginManager().callEvent(event); MainUtil.sendMessage(plr, C.HELPER_REMOVED); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java index 2fd8c6803..41064de4e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java @@ -131,7 +131,7 @@ public class Inbox extends SubCommand { } else { below = true; } - final String world = plr.getWorld().getName(); + final String world = loc.getWorld(); final int tier2 = tier; Bukkit.getScheduler().runTaskAsynchronously(PlotSquared.getMain(), new Runnable() { @Override diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java index 5134a8b8a..0c4fca7d6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java @@ -257,7 +257,7 @@ public class Schematic extends SubCommand { return false; } p2 = myplot; - world = plr.getWorld().getName(); + world = loc.getWorld(); } else { if (args.length == 3) { try { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java index 7dccdbaef..3b5732eb3 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java @@ -169,7 +169,7 @@ public class Set extends SubCommand { if (args.length > 1) { if (args[1].equalsIgnoreCase("none")) { plot.settings.setPosition(null); - DBFunc.setPosition(plr.getWorld().getName(), plot, ""); + DBFunc.setPosition(loc.getWorld(), plot, ""); return true; } return MainUtil.sendMessage(plr, C.HOME_ARGUMENT); @@ -181,7 +181,7 @@ public class Set extends SubCommand { final Location relative = plr.getLocation().subtract(base); final BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ()); plot.settings.setPosition(blockloc); - DBFunc.setPosition(plr.getWorld().getName(), plot, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ()); + DBFunc.setPosition(loc.getWorld(), plot, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ()); return MainUtil.sendMessage(plr, C.POSITION_SET); } if (args[0].equalsIgnoreCase("alias")) { @@ -204,7 +204,7 @@ public class Set extends SubCommand { return false; } } - DBFunc.setAlias(plr.getWorld().getName(), plot, alias); + DBFunc.setAlias(loc.getWorld(), plot, alias); MainUtil.sendMessage(plr, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias)); return true; } 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 92ae320c3..e32a18db8 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java @@ -76,14 +76,14 @@ public class Trusted extends SubCommand { } if (plot.helpers.contains(uuid)) { plot.helpers.remove(uuid); - DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid); + DBFunc.removeHelper(loc.getWorld(), plot, uuid); } if (plot.denied.contains(uuid)) { plot.denied.remove(uuid); - DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid); + DBFunc.removeDenied(loc.getWorld(), plot, uuid); } plot.addTrusted(uuid); - DBFunc.setTrusted(plr.getWorld().getName(), plot, uuid); + DBFunc.setTrusted(loc.getWorld(), plot, uuid); final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true); Bukkit.getPluginManager().callEvent(event); } else { @@ -100,13 +100,13 @@ public class Trusted extends SubCommand { return true; } plot.removeTrusted(uuid); - DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid); + DBFunc.removeTrusted(loc.getWorld(), plot, uuid); MainUtil.sendMessage(plr, C.TRUSTED_REMOVED); return true; } final UUID uuid = UUIDHandler.getUUID(args[1]); plot.removeTrusted(uuid); - DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid); + DBFunc.removeTrusted(loc.getWorld(), plot, uuid); final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false); Bukkit.getPluginManager().callEvent(event); MainUtil.sendMessage(plr, C.TRUSTED_REMOVED); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java index 839fb5f08..ea46acab5 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java @@ -61,7 +61,7 @@ public class Unclaim extends SubCommand { sendMessage(plr, C.ADDED_BALANCE, c + ""); } } - final boolean result = PlotSquared.removePlot(plr.getWorld().getName(), plot.id, true); + final boolean result = PlotSquared.removePlot(loc.getWorld(), plot.id, true); if (result) { final World world = plr.getWorld(); final String worldname = world.getName();