From 2b0006b7f9850876d7372583475c0579df576fb0 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 22 Feb 2015 16:52:19 +1100 Subject: [PATCH] lkjdasklsad --- .../plot/commands/Clear.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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 447b3e464..80021a350 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java @@ -20,14 +20,14 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; -import org.bukkit.Bukkit; - import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.object.Location; 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.bukkit.BukkitPlayerFunctions; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; @@ -51,11 +51,11 @@ public class Clear extends SubCommand { if (!PlotSquared.isPlotWorld(world)) { PlotSquared.log("Invalid plot world: " + world); } else { - final Plot plot = MainUtil.getPlot(Bukkit.getWorld(world), id); + final Plot plot = MainUtil.getPlot(world, id); if (plot == null) { PlotSquared.log("Could not find plot " + args[0] + " in world " + world); } else { - plot.clear(null, false); + MainUtil.clear(world, plot, true, null); PlotSquared.log("Plot " + plot.getId().toString() + " cleared."); } } @@ -63,17 +63,19 @@ public class Clear extends SubCommand { } return true; } - if (!BukkitPlayerFunctions.isInPlot(plr)) { + Location loc = plr.getLocation(); + 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))) { + if (!MainUtil.getTopPlot(loc.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(loc.getWorld(), plot))) { return sendMessage(plr, C.UNLINK_REQUIRED); } if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.clear")) { return sendMessage(plr, C.NO_PLOT_PERMS); } assert plot != null; + boolean result = MainUtil.clearAsPlayer(plot, isDelete, whenDone); plot.clear(plr, false); // sign // wall