From ef9e1dd1acd4067f6159e06ad0f552cd540d64ae Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 22 Feb 2015 18:03:25 +1100 Subject: [PATCH] inplot --- .../plot/commands/Helpers.java | 9 +-- .../plot/commands/Inbox.java | 9 +-- .../plot/commands/Info.java | 9 +-- .../plot/commands/Kick.java | 9 +-- .../plot/commands/Merge.java | 9 +-- .../plot/commands/MusicSubcommand.java | 9 +-- .../plot/commands/Paste.java | 67 ------------------- .../plot/commands/Rate.java | 9 +-- .../plot/commands/Schematic.java | 9 +-- .../plot/commands/Set.java | 8 +-- .../plot/commands/Swap.java | 9 +-- .../plot/commands/Trusted.java | 9 +-- .../plot/commands/Unban.java | 33 --------- .../plot/commands/Unclaim.java | 6 +- .../plot/commands/Unlink.java | 8 ++- .../plot/commands/WE_Anywhere.java | 1 + 16 files changed, 64 insertions(+), 149 deletions(-) delete mode 100644 PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java delete mode 100644 PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java 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 9dbcfc490..df4a5d532 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java @@ -27,6 +27,7 @@ import org.bukkit.Bukkit; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; @@ -44,11 +45,11 @@ public class Helpers extends SubCommand { MainUtil.sendMessage(plr, C.HELPER_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; 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 41064de4e..b64e26082 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java @@ -30,6 +30,7 @@ import org.bukkit.Bukkit; import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotComment; import com.intellectualcrafters.plot.object.PlotPlayer; @@ -50,11 +51,11 @@ public class Inbox extends SubCommand { report = true; } } - if (!BukkitPlayerFunctions.isInPlot(plr) && !report) { - MainUtil.sendMessage(plr, C.NOT_IN_PLOT); - return false; - } + Location loc = plr.getLocation(); final Plot plot = MainUtil.getPlot(loc); + if (plot == null && !report) { + return !sendMessage(plr, C.NOT_IN_PLOT); + } 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 f1bb0b464..c7dd552ce 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java @@ -57,14 +57,15 @@ public class Info extends SubCommand { World world; Plot plot; if (player != null) { - world = player.getWorld(); + Location loc = player.getLocation(); + String world = loc.getWorld(); if (!PlotSquared.isPlotWorld(world)) { MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_IN_PLOT_WORLD); return false; } - if (!BukkitPlayerFunctions.isInPlot(player)) { - MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_IN_PLOT); - return false; + final Plot plot = MainUtil.getPlot(loc); + if (plot == null) { + return !sendMessage(plr, C.NOT_IN_PLOT); } plot = MainUtil.getPlot(loc); } else { 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 6a3129b5b..5c7850a95 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java @@ -24,6 +24,7 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; @@ -38,11 +39,11 @@ public class Kick extends SubCommand { @Override public boolean execute(final PlotPlayer plr, final String... args) { - if (!BukkitPlayerFunctions.isInPlot(plr)) { - MainUtil.sendMessage(plr, "You're not in a plot."); - return false; - } + 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() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.kick")) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); 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 b994c744f..a824c664e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -31,6 +31,7 @@ import org.bukkit.World; import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.events.PlotMergeEvent; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; @@ -75,11 +76,11 @@ public class Merge extends SubCommand { @Override public boolean execute(final PlotPlayer plr, final String... args) { - 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; 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 0e6be05d3..9d9e839b8 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java @@ -29,6 +29,7 @@ import org.bukkit.inventory.meta.ItemMeta; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.listeners.PlotPlusListener; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; @@ -41,11 +42,11 @@ public class MusicSubcommand extends SubCommand { @Override public boolean execute(final PlotPlayer player, final String... args) { - if (!BukkitPlayerFunctions.isInPlot(player)) { - sendMessage(player, 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.hasRights(player)) { sendMessage(player, C.NO_PLOT_PERMS); return true; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java deleted file mode 100644 index d347b2d56..000000000 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java +++ /dev/null @@ -1,67 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////////////////////////// -// PlotSquared - A plot manager and world generator for the Bukkit API / -// Copyright (c) 2014 IntellectualSites/IntellectualCrafters / -// / -// This program is free software; you can redistribute it and/or modify / -// it under the terms of the GNU General Public License as published by / -// the Free Software Foundation; either version 3 of the License, or / -// (at your option) any later version. / -// / -// This program is distributed in the hope that it will be useful, / -// but WITHOUT ANY WARRANTY; without even the implied warranty of / -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the / -// GNU General Public License for more details. / -// / -// You should have received a copy of the GNU General Public License / -// along with this program; if not, write to the Free Software Foundation, / -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA / -// / -// You can contact us via: support@intellectualsites.com / -//////////////////////////////////////////////////////////////////////////////////////////////////// -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; -import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; - -public class Paste extends SubCommand { - public Paste() { - super(Command.PASTE, "Paste a plot", "paste", CommandCategory.ACTIONS, true); - } - - @Override - public boolean execute(final PlotPlayer plr, final String... args) { - if (!BukkitPlayerFunctions.isInPlot(plr)) { - MainUtil.sendMessage(plr, C.NOT_IN_PLOT); - return false; - } - 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; - } - if (!MainUtil.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { - MainUtil.sendMessage(plr, C.UNLINK_REQUIRED); - return false; - } - assert plot != null; - final int size = (MainUtil.getPlotTopLocAbs(plr.getWorld(), plot.getId()).getBlockX() - MainUtil.getPlotBottomLocAbs(plr.getWorld(), plot.getId()).getBlockX()); - if (PlotSelection.currentSelection.containsKey(plr.getName())) { - final PlotSelection selection = PlotSelection.currentSelection.get(plr.getName()); - if (size != selection.getWidth()) { - sendMessage(plr, C.PASTE_FAILED, "The size of the current plot is not the same as the paste"); - return false; - } - selection.paste(plr.getWorld(), plot); - sendMessage(plr, C.PASTED); - } else { - sendMessage(plr, C.NO_CLIPBOARD); - return false; - } - PlotSelection.currentSelection.remove(plr.getName()); - return true; - } -} 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 d1dcbee17..435dc061e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java @@ -22,6 +22,7 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; @@ -44,11 +45,11 @@ public class Rate extends SubCommand { sendMessage(plr, C.RATING_NOT_VALID); return true; } - if (!BukkitPlayerFunctions.isInPlot(plr)) { - 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.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 0c4fca7d6..a219479ca 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java @@ -36,6 +36,7 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler.DataCollection; import com.intellectualcrafters.plot.util.SchematicHandler.Dimension; @@ -247,11 +248,11 @@ public class Schematic extends SubCommand { final String world; final Plot p2; if (plr != null) { - if (!BukkitPlayerFunctions.isInPlot(plr)) { - sendMessage(plr, C.NOT_IN_PLOT); - return false; + Location loc = plr.getLocation(); + final Plot plot = MainUtil.getPlot(loc); + if (plot == null) { + return !sendMessage(plr, C.NOT_IN_PLOT); } - 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 3b5732eb3..1a302f0b4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java @@ -64,11 +64,11 @@ public class Set extends SubCommand { @SuppressWarnings("deprecation") @Override public boolean execute(final PlotPlayer plr, final String... args) { - if (!BukkitPlayerFunctions.isInPlot(plr)) { - MainUtil.sendMessage(plr, C.NOT_IN_PLOT); - return false; - } + Location loc = plr.getLocation(); final Plot plot = MainUtil.getPlot(loc); + if (plot == null) { + return !sendMessage(plr, C.NOT_IN_PLOT); + } if (!plot.hasOwner()) { sendMessage(plr, C.PLOT_NOT_CLAIMED); 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 fe199a973..fe50a2b6f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java @@ -25,6 +25,7 @@ import org.bukkit.World; import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; @@ -49,11 +50,11 @@ public class Swap extends SubCommand { MainUtil.sendMessage(plr, C.SWAP_SYNTAX); return false; } - if (!BukkitPlayerFunctions.isInPlot(plr)) { - MainUtil.sendMessage(plr, C.NOT_IN_PLOT); - return false; - } + 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() || !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 e32a18db8..629e5765f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java @@ -27,6 +27,7 @@ import org.bukkit.Bukkit; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; @@ -45,11 +46,11 @@ public class Trusted extends SubCommand { MainUtil.sendMessage(plr, C.TRUSTED_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; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java deleted file mode 100644 index 183792a60..000000000 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java +++ /dev/null @@ -1,33 +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 Unban extends SubCommand { - public Unban() { - super(Command.UNBAN, "Alias for /plot denied remove", "/plot unban [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); - } - if (!BukkitPlayerFunctions.isInPlot(plr)) { - return sendMessage(plr, C.NOT_IN_PLOT); - } - final Plot plot = MainUtil.getPlot(loc); - if (!plot.hasRights(plr)) { - return sendMessage(plr, C.NO_PLOT_PERMS); - } - return plr.performCommand("plot denied remove " + args[0]); - } -} 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 ea46acab5..3ee36d6a1 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java @@ -27,6 +27,7 @@ import org.bukkit.World; import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; @@ -41,10 +42,11 @@ public class Unclaim extends SubCommand { @Override public boolean execute(final PlotPlayer plr, final String... args) { - if (!BukkitPlayerFunctions.isInPlot(plr)) { + Location loc = plr.getLocation(); + final Plot plot = MainUtil.getPlot(loc); + if (plot == null) { return !sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = MainUtil.getPlot(loc); if (!MainUtil.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 2b5cb847f..0fc40c6c4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java @@ -30,6 +30,7 @@ import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.events.PlotUnlinkEvent; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotManager; @@ -51,10 +52,11 @@ public class Unlink extends SubCommand { @Override public boolean execute(final PlotPlayer plr, final String... args) { - if (!BukkitPlayerFunctions.isInPlot(plr)) { - return sendMessage(plr, C.NOT_IN_PLOT); - } + 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() || !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/commands/WE_Anywhere.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java index 69cd4fbd9..83054b54a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java @@ -23,6 +23,7 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.PWE; public class WE_Anywhere extends SubCommand {