lkjdasklsad

This commit is contained in:
boy0001 2015-02-22 16:52:19 +11:00
parent 54ad7fefce
commit 2b0006b7f9

View File

@ -20,14 +20,14 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import org.bukkit.Bukkit;
import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil; 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.BukkitPlayerFunctions;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
@ -51,11 +51,11 @@ public class Clear extends SubCommand {
if (!PlotSquared.isPlotWorld(world)) { if (!PlotSquared.isPlotWorld(world)) {
PlotSquared.log("Invalid plot world: " + world); PlotSquared.log("Invalid plot world: " + world);
} else { } else {
final Plot plot = MainUtil.getPlot(Bukkit.getWorld(world), id); final Plot plot = MainUtil.getPlot(world, id);
if (plot == null) { if (plot == null) {
PlotSquared.log("Could not find plot " + args[0] + " in world " + world); PlotSquared.log("Could not find plot " + args[0] + " in world " + world);
} else { } else {
plot.clear(null, false); MainUtil.clear(world, plot, true, null);
PlotSquared.log("Plot " + plot.getId().toString() + " cleared."); PlotSquared.log("Plot " + plot.getId().toString() + " cleared.");
} }
} }
@ -63,17 +63,19 @@ public class Clear extends SubCommand {
} }
return true; 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); return sendMessage(plr, C.NOT_IN_PLOT);
} }
final Plot plot = MainUtil.getPlot(loc); if (!MainUtil.getTopPlot(loc.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(loc.getWorld(), plot))) {
if (!MainUtil.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
return sendMessage(plr, C.UNLINK_REQUIRED); return sendMessage(plr, C.UNLINK_REQUIRED);
} }
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.clear")) { 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); return sendMessage(plr, C.NO_PLOT_PERMS);
} }
assert plot != null; assert plot != null;
boolean result = MainUtil.clearAsPlayer(plot, isDelete, whenDone);
plot.clear(plr, false); plot.clear(plr, false);
// sign // sign
// wall // wall