From 42aeb1479dfc50b7ff94890b0b059675e6f71714 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 22 Feb 2015 18:28:52 +1100 Subject: [PATCH] purge --- .../plot/commands/Purge.java | 16 ++++++++-------- .../plot/commands/plugin.java | 13 +++++-------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java index 50057bc14..e4c9a83ef 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java @@ -34,6 +34,7 @@ import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; @@ -93,12 +94,11 @@ public class Purge extends SubCommand { MainUtil.sendMessage(plr, C.PURGE_SYNTAX); return false; } - final World world = Bukkit.getWorld(args[1]); - if ((world == null) || !PlotSquared.isPlotWorld(world)) { - MainUtil.sendMessage(null, C.NOT_VALID_PLOT_WORLD); + final String worldname = args[0]; + if (!BlockManager.manager.isWorld(worldname) || !PlotSquared.isPlotWorld(worldname)) { + MainUtil.sendMessage(plr, "INVALID WORLD"); return false; } - final String worldname = world.getName(); final String arg = args[0].toLowerCase(); final PlotId id = getId(arg); if (id != null) { @@ -112,7 +112,7 @@ public class Purge extends SubCommand { } final UUID uuid = UUIDHandler.getUUID(args[0]); if (uuid != null) { - final Set plots = PlotSquared.getPlots(world, uuid); + final Set plots = PlotSquared.getPlots(worldname, uuid); final Set ids = new HashSet<>(); for (final Plot plot : plots) { ids.add(plot.id); @@ -121,7 +121,7 @@ public class Purge extends SubCommand { return finishPurge(ids.size()); } if (arg.equals("all")) { - final Set ids = PlotSquared.getPlots(world).keySet(); + final Set ids = PlotSquared.getPlots(worldname).keySet(); if (ids.size() == 0) { return MainUtil.sendMessage(null, "&cNo plots found"); } @@ -129,7 +129,7 @@ public class Purge extends SubCommand { return finishPurge(ids.size()); } if (arg.equals("unknown")) { - final Collection plots = PlotSquared.getPlots(world).values(); + final Collection plots = PlotSquared.getPlots(worldname).values(); final Set ids = new HashSet<>(); for (final Plot plot : plots) { if (plot.owner != null) { @@ -146,7 +146,7 @@ public class Purge extends SubCommand { return finishPurge(ids.size()); } if (arg.equals("unowned")) { - final Collection plots = PlotSquared.getPlots(world).values(); + final Collection plots = PlotSquared.getPlots(worldname).values(); final Set ids = new HashSet<>(); for (final Plot plot : plots) { if (plot.owner == null) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java index 8f1b73f78..f65091931 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java @@ -26,9 +26,6 @@ import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; -import org.bukkit.Bukkit; -import org.bukkit.plugin.java.JavaPlugin; - import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; @@ -41,8 +38,8 @@ public class plugin extends SubCommand { super("plugin", "plots.use", "Show plugin information", "plugin", "version", CommandCategory.INFO, false); } - public static void setup(final JavaPlugin plugin) { - plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { + public static void setup() { + TaskManager.runTaskAsync(new Runnable() { @Override public void run() { try { @@ -51,8 +48,8 @@ public class plugin extends SubCommand { downloads = "unknown"; } } - }, 1l); - plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { + }); + TaskManager.runTaskLaterAsync(new Runnable() { @Override public void run() { try { @@ -62,7 +59,7 @@ public class plugin extends SubCommand { version = "unknown"; } } - }, 200l); + }, 200); } private static String convertToNumericString(final String str, final boolean dividers) {