From 1eb0ba47b48f755f68846b4a287e0b300589f2df Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sat, 21 Feb 2015 23:01:15 +1100 Subject: [PATCH] cmd --- .../plot/commands/Ban.java | 34 ------------------- .../plot/commands/Buy.java | 8 +++-- .../plot/commands/Claim.java | 2 +- .../plot/commands/Clear.java | 2 +- .../plot/commands/Comment.java | 2 +- .../plot/commands/Copy.java | 2 +- .../plot/commands/CreateRoadSchematic.java | 2 +- .../plot/commands/DEOP.java | 2 +- .../plot/commands/DebugClear.java | 2 +- .../plot/commands/Delete.java | 2 +- .../plot/commands/Denied.java | 4 +-- .../plot/commands/FlagCmd.java | 2 +- .../plot/commands/Helpers.java | 2 +- .../plot/commands/Inbox.java | 2 +- .../plot/commands/Info.java | 2 +- .../plot/commands/Kick.java | 4 +-- .../plot/commands/Merge.java | 2 +- .../plot/commands/MusicSubcommand.java | 2 +- .../plot/commands/OP.java | 2 +- .../plot/commands/Paste.java | 2 +- .../plot/commands/Rate.java | 2 +- .../plot/commands/Schematic.java | 6 ++-- .../plot/commands/Set.java | 2 +- .../plot/commands/SetOwner.java | 2 +- .../plot/commands/Swap.java | 2 +- .../plot/commands/Trusted.java | 2 +- .../plot/commands/Unban.java | 2 +- .../plot/commands/Unclaim.java | 2 +- .../plot/commands/Unlink.java | 2 +- .../plot/listeners/ForceFieldListener.java | 2 +- 30 files changed, 37 insertions(+), 69 deletions(-) delete mode 100644 PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Ban.java diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Ban.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Ban.java deleted file mode 100644 index b4092996b..000000000 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Ban.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.intellectualcrafters.plot.commands; - -import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.object.Plot; -import com.intellectualcrafters.plot.object.PlotPlayer; -import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions; - -/** - * Created 2014-11-09 for PlotSquared - * - * @author Citymonstret - */ -public class Ban extends SubCommand { - public Ban() { - super(Command.BAN, "Alias for /plot denied add", "/plot ban [player]", CommandCategory.ACTIONS, true); - } - - @Override - public boolean execute(final PlotPlayer plr, final String... args) { - if (args.length < 1) { - return MainUtil.sendMessage(plr, "&cUsage: &c" + this.usage); - } - Plot plot = MainUtil.getPlot(plr.getLocation()); - if (plot == null) { - return sendMessage(plr, C.NOT_IN_PLOT); - } - if (!plot.isAdded(plr.getUUID())) { - return sendMessage(plr, C.NO_PLOT_PERMS); - } - - return plr.performCommand("plot denied add " + args[0]); - } -} diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java index ec0db781d..d6ed4426f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java @@ -27,6 +27,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.FlagManager; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; @@ -45,10 +46,11 @@ public class Buy extends SubCommand { @Override public boolean execute(final PlotPlayer plr, final String... args) { - if (!PlotSquared.useEconomy) { + if (PlotSquared.economy == null) { return sendMessage(plr, C.ECON_DISABLED); } - final World world = plr.getWorld(); + Location loc = plr.getLocation(); + final String world = loc.getWorld(); if (!PlotSquared.isPlotWorld(world)) { return sendMessage(plr, C.NOT_IN_PLOT_WORLD); } @@ -62,7 +64,7 @@ public class Buy extends SubCommand { return sendMessage(plr, C.NOT_VALID_PLOT_ID); } } else { - plot = BukkitPlayerFunctions.getCurrentPlot(plr); + plot = MainUtil.getPlot(loc); } if (plot == null) { return sendMessage(plr, C.NOT_IN_PLOT); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index baa6c6712..58385f02c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -92,7 +92,7 @@ public class Claim extends SubCommand { if (BukkitPlayerFunctions.getPlayerPlotCount(plr.getWorld(), plr) >= BukkitPlayerFunctions.getAllowedPlots(plr)) { return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (plot.hasOwner()) { return sendMessage(plr, C.PLOT_IS_CLAIMED); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java index 5462e624e..d245d642a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java @@ -66,7 +66,7 @@ public class Clear extends SubCommand { if (!BukkitPlayerFunctions.isInPlot(plr)) { return sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { return sendMessage(plr, C.UNLINK_REQUIRED); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java index 25d876563..a04e250de 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java @@ -42,7 +42,7 @@ public class Comment extends SubCommand { if (!BukkitPlayerFunctions.isInPlot(plr)) { return sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (!plot.hasOwner()) { return sendMessage(plr, C.NOT_IN_PLOT); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java index a800e0002..2a13db78a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java @@ -38,7 +38,7 @@ public class Copy extends SubCommand { MainUtil.sendMessage(plr, C.NOT_IN_PLOT); return false; } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.copy")) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return false; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java index 5577f5b7e..4591cdce2 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java @@ -43,7 +43,7 @@ public class CreateRoadSchematic extends SubCommand { if (!(PlotSquared.getPlotWorld(player.getWorld()) instanceof HybridPlotWorld)) { return sendMessage(player, C.NOT_IN_PLOT_WORLD); } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(player); + final Plot plot = MainUtil.getPlot(loc); final HybridPlotManager manager = (HybridPlotManager) PlotSquared.getPlotManager(player.getWorld()); manager.setupRoadSchematic(plot); MainUtil.update(BukkitUtil.getLocation(entity)); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java index e79c15abf..f85c18882 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java @@ -24,7 +24,7 @@ public class DEOP extends SubCommand { if (!BukkitPlayerFunctions.isInPlot(plr)) { return sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (!plot.hasRights(plr)) { return sendMessage(plr, C.NO_PLOT_PERMS); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java index 2c6506e87..b1d7b316d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java @@ -84,7 +84,7 @@ public class DebugClear extends SubCommand { if (!BukkitPlayerFunctions.isInPlot(plr) || !(PlotSquared.getPlotWorld(plr.getWorld()) instanceof SquarePlotWorld)) { return sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { return sendMessage(plr, C.UNLINK_REQUIRED); } 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 b198851e2..d16999d8a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java @@ -42,7 +42,7 @@ public class Delete extends SubCommand { if (!BukkitPlayerFunctions.isInPlot(plr)) { return !sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { return !sendMessage(plr, C.UNLINK_REQUIRED); } 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 2afce81f4..3a29cc28b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java @@ -50,7 +50,7 @@ public class Denied extends SubCommand { MainUtil.sendMessage(plr, C.NOT_IN_PLOT); return true; } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if ((plot == null) || !plot.hasOwner()) { MainUtil.sendMessage(plr, C.PLOT_UNOWNED); return false; @@ -93,7 +93,7 @@ public class Denied extends SubCommand { } final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid); if (!uuid.equals(DBFunc.everyone) && (player != null) && player.isOnline()) { - final Plot pl = BukkitPlayerFunctions.getCurrentPlot(player); + final Plot pl = MainUtil.getPlot(loc); if ((pl != null) && pl.id.equals(plot.id)) { MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.YOU_BE_DENIED); player.teleport(player.getWorld().getSpawnLocation()); 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 6565b6b8f..5b8aaa150 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java @@ -56,7 +56,7 @@ public class FlagCmd extends SubCommand { MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.COMMAND_SYNTAX, "/plot flag "); return false; } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(player); + final Plot plot = MainUtil.getPlot(loc); if (plot == null) { MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_IN_PLOT); return 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 c82ab5e19..78c89d84f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java @@ -48,7 +48,7 @@ public class Helpers extends SubCommand { MainUtil.sendMessage(plr, C.NOT_IN_PLOT); return true; } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if ((plot == null) || !plot.hasOwner()) { MainUtil.sendMessage(plr, C.PLOT_UNOWNED); return false; 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 0919f5f99..2fd8c6803 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java @@ -54,7 +54,7 @@ public class Inbox extends SubCommand { MainUtil.sendMessage(plr, C.NOT_IN_PLOT); return false; } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if ((plot != null) && !plot.hasOwner()) { MainUtil.sendMessage(plr, C.NOT_IN_PLOT); return false; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java index ee8de8f56..baa4e0559 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java @@ -66,7 +66,7 @@ public class Info extends SubCommand { MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_IN_PLOT); return false; } - plot = BukkitPlayerFunctions.getCurrentPlot(player); + plot = MainUtil.getPlot(loc); } else { if (args.length < 2) { MainUtil.sendMessage(null, C.INFO_SYNTAX_CONSOLE); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java index 5db8c76aa..6a3129b5b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java @@ -42,7 +42,7 @@ public class Kick extends SubCommand { MainUtil.sendMessage(plr, "You're not in a plot."); return false; } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.kick")) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return false; @@ -56,7 +56,7 @@ public class Kick extends SubCommand { return false; } final Player player = Bukkit.getPlayer(args[0]); - if (!player.getWorld().equals(plr.getWorld()) || !BukkitPlayerFunctions.isInPlot(player) || (BukkitPlayerFunctions.getCurrentPlot(player) == null) || !BukkitPlayerFunctions.getCurrentPlot(player).equals(plot)) { + if (!player.getWorld().equals(plr.getWorld()) || !BukkitPlayerFunctions.isInPlot(player) || (MainUtil.getPlot(loc) == null) || !MainUtil.getPlot(loc).equals(plot)) { MainUtil.sendMessage(plr, C.INVALID_PLAYER.s().replaceAll("%player%", args[0])); return false; } 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 e8311c8ae..b413fbef9 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -78,7 +78,7 @@ public class Merge extends SubCommand { MainUtil.sendMessage(plr, C.NOT_IN_PLOT); return true; } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if ((plot == null) || !plot.hasOwner()) { MainUtil.sendMessage(plr, C.PLOT_UNOWNED); return false; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java index 8cc68c9fe..78b7526ed 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java @@ -44,7 +44,7 @@ public class MusicSubcommand extends SubCommand { sendMessage(player, C.NOT_IN_PLOT); return true; } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(player); + final Plot plot = MainUtil.getPlot(loc); if (!plot.hasRights(player)) { sendMessage(player, C.NO_PLOT_PERMS); return true; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java index b953d97bd..23e7aba06 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java @@ -24,7 +24,7 @@ public class OP extends SubCommand { if (!BukkitPlayerFunctions.isInPlot(plr)) { return sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (!plot.hasRights(plr)) { return sendMessage(plr, C.NO_PLOT_PERMS); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java index 2ad66e890..70fcd2188 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java @@ -38,7 +38,7 @@ public class Paste extends SubCommand { MainUtil.sendMessage(plr, C.NOT_IN_PLOT); return false; } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.paste")) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return false; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java index 59f3e21d8..440a54ab8 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java @@ -47,7 +47,7 @@ public class Rate extends SubCommand { sendMessage(plr, C.NOT_IN_PLOT); return true; } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (!plot.hasOwner()) { sendMessage(plr, C.RATING_NOT_OWNED); return true; 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 6563a38ea..5134a8b8a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java @@ -98,7 +98,7 @@ public class Schematic extends SubCommand { } final int x; final int z; - final Plot plot2 = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot2 = MainUtil.getPlot(loc); final Dimension dem = schematic.getSchematicDimension(); final Location bot = MainUtil.getPlotBottomLoc(plr.getWorld(), plot2.id).add(1, 0, 1); final int length2 = MainUtil.getPlotWidth(plr.getWorld(), plot2.id); @@ -165,7 +165,7 @@ public class Schematic extends SubCommand { } final int l1 = schematic.getSchematicDimension().getX(); final int l2 = schematic.getSchematicDimension().getZ(); - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); final int length = MainUtil.getPlotWidth(plr.getWorld(), plot.id); if ((l1 < length) || (l2 < length)) { sendMessage(plr, C.SCHEMATIC_INVALID, String.format("Wrong size (x: %s, z: %d) vs %d ", l1, l2, length)); @@ -251,7 +251,7 @@ public class Schematic extends SubCommand { sendMessage(plr, C.NOT_IN_PLOT); return false; } - final Plot myplot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot myplot = MainUtil.getPlot(loc); if (!myplot.hasRights(plr)) { sendMessage(plr, C.NO_PLOT_PERMS); return false; 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 191e62968..7dccdbaef 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java @@ -68,7 +68,7 @@ public class Set extends SubCommand { MainUtil.sendMessage(plr, C.NOT_IN_PLOT); return false; } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (!plot.hasOwner()) { sendMessage(plr, C.PLOT_NOT_CLAIMED); return false; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java index 0b999315b..8c25d99b6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java @@ -51,7 +51,7 @@ public class SetOwner extends SubCommand { @Override public boolean execute(final PlotPlayer plr, final String... args) { - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if ((plot == null) || (plot.owner == null)) { MainUtil.sendMessage(plr, C.NOT_IN_PLOT); return false; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java index b2435bce1..fe199a973 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java @@ -53,7 +53,7 @@ public class Swap extends SubCommand { MainUtil.sendMessage(plr, C.NOT_IN_PLOT); return false; } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.swap")) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return 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 5dff8fe4e..92ae320c3 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java @@ -49,7 +49,7 @@ public class Trusted extends SubCommand { MainUtil.sendMessage(plr, C.NOT_IN_PLOT); return true; } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if ((plot == null) || !plot.hasOwner()) { MainUtil.sendMessage(plr, C.PLOT_UNOWNED); return false; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java index 8da5ab61f..183792a60 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java @@ -24,7 +24,7 @@ public class Unban extends SubCommand { if (!BukkitPlayerFunctions.isInPlot(plr)) { return sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (!plot.hasRights(plr)) { return sendMessage(plr, C.NO_PLOT_PERMS); } 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 54490d600..7c4a9413b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java @@ -44,7 +44,7 @@ public class Unclaim extends SubCommand { if (!BukkitPlayerFunctions.isInPlot(plr)) { return !sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { return !sendMessage(plr, C.UNLINK_REQUIRED); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java index 452426514..fb0d40673 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java @@ -54,7 +54,7 @@ public class Unlink extends SubCommand { if (!BukkitPlayerFunctions.isInPlot(plr)) { return sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + final Plot plot = MainUtil.getPlot(loc); if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.unlink")) { return sendMessage(plr, C.NO_PLOT_PERMS); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java index cf8e23d8e..508586a8c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java @@ -99,7 +99,7 @@ public class ForceFieldListener implements Listener { if (!BukkitPlayerFunctions.isInPlot(player)) { return; } - final Plot plot = BukkitPlayerFunctions.getCurrentPlot(player); + final Plot plot = MainUtil.getPlot(loc); if ((FlagManager.getPlotFlag(plot, "forcefield") != null) && FlagManager.getPlotFlag(plot, "forcefield").getValue().equals("true")) { if (!PlotListener.booleanFlag(plot, "forcefield", false)) { UUID uuid = UUIDHandler.getUUID(player);