diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java index f0729e205..ea27418db 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java @@ -31,15 +31,15 @@ import java.util.List; import java.util.Map.Entry; import java.util.UUID; -import org.apache.commons.lang.StringUtils; import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.World; import com.intellectualcrafters.plot.PlotSquared; +import com.intellectualcrafters.plot.object.BukkitOfflinePlayer; import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.util.AChunkManager; +import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.ExpireManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; @@ -74,8 +74,8 @@ public class DebugExec extends SubCommand { } case "update-expired": { if (args.length > 1) { - final World world = Bukkit.getWorld(args[1]); - if (world == null) { + final String world = args[1]; + if (!BlockManager.manager.isWorld(world)) { return MainUtil.sendMessage(null, "Invalid world: " + args[1]); } MainUtil.sendMessage(null, "Updating expired plot list"); @@ -86,10 +86,13 @@ public class DebugExec extends SubCommand { } case "show-expired": { if (args.length > 1) { - final World world = Bukkit.getWorld(args[1]); - if ((world == null) || !ExpireManager.expiredPlots.containsKey(args[1])) { + final String world = args[1]; + if (!BlockManager.manager.isWorld(world)) { return MainUtil.sendMessage(null, "Invalid world: " + args[1]); } + if (!ExpireManager.expiredPlots.containsKey(args[1])) { + return MainUtil.sendMessage(null, "No task for world: " + args[1]); + } MainUtil.sendMessage(null, "Expired plots (" + ExpireManager.expiredPlots.get(args[1]).size() + "):"); for (final Entry entry : ExpireManager.expiredPlots.get(args[1]).entrySet()) { final Plot plot = entry.getKey(); @@ -108,8 +111,8 @@ public class DebugExec extends SubCommand { if (uuid == null) { return MainUtil.sendMessage(null, "player not found: " + args[1]); } - final OfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid); - if ((op == null) || !op.hasPlayedBefore()) { + BukkitOfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid); + if ((op == null) || op.getLastPlayed() == 0) { return MainUtil.sendMessage(null, "player hasn't connected before: " + args[1]); } final Timestamp stamp = new Timestamp(op.getLastPlayed()); @@ -127,8 +130,8 @@ public class DebugExec extends SubCommand { MainUtil.sendMessage(null, "&7 - Generates a list of regions to trim"); return MainUtil.sendMessage(null, "&7 - Run after plot expiry has run"); } - final World world = Bukkit.getWorld(args[1]); - if ((world == null) || !PlotSquared.isPlotWorld(args[1])) { + final String world = args[1]; + if (!BlockManager.manager.isWorld(world) || !PlotSquared.isPlotWorld(args[1])) { return MainUtil.sendMessage(null, "Invalid world: " + args[1]); } final ArrayList empty = new ArrayList<>(); @@ -143,9 +146,8 @@ public class DebugExec extends SubCommand { PrintWriter writer; try { writer = new PrintWriter(file); - final String worldname = world.getName(); for (final ChunkLoc loc : empty) { - writer.println(worldname + "/region/r." + loc.x + "." + loc.z + ".mca"); + writer.println(world + "/region/r." + loc.x + "." + loc.z + ".mca"); } writer.close(); Trim.sendMessage("File saved to 'plugins/PlotSquared/trim.txt'"); @@ -166,7 +168,7 @@ public class DebugExec extends SubCommand { } } } - MainUtil.sendMessage(BukkitUtil.getPlayer(player), "Possible sub commands: /plot debugexec <" + StringUtils.join(allowed_params, "|") + ">"); + MainUtil.sendMessage(player, "Possible sub commands: /plot debugexec <" + StringUtils.join(allowed_params, "|") + ">"); return true; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java index 509143a05..b5c455783 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java @@ -38,6 +38,7 @@ import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.util.AChunkManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.bukkit.ChunkManager; @@ -162,7 +163,7 @@ public class Trim extends SubCommand { return true; } - public static boolean getTrimRegions(final ArrayList empty, final World world, final Runnable whenDone) { + public static boolean getTrimRegions(final ArrayList empty, final String world, final Runnable whenDone) { if (Trim.TASK) { return false; } @@ -170,7 +171,7 @@ public class Trim extends SubCommand { sendMessage("Collecting region data..."); final ArrayList plots = new ArrayList<>(); plots.addAll(PlotSquared.getPlots(world).values()); - final HashSet chunks = new HashSet<>(ChunkManager.getChunkChunks(world)); + final HashSet chunks = new HashSet<>(AChunkManager.manager.getChunkChunks(world)); sendMessage(" - MCA #: " + chunks.size()); sendMessage(" - CHUNKS: " + (chunks.size() * 1024) + " (max)"); sendMessage(" - TIME ESTIMATE: " + (chunks.size() / 1200) + " minutes"); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java index 945680cd8..a7026c09f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java @@ -10,7 +10,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Player; import com.intellectualcrafters.plot.BukkitMain; import com.intellectualcrafters.plot.PlotSquared; @@ -24,7 +23,6 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; -import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; public class ExpireManager {