From 5968b9e22e1dd2c26ec21caf1eacb5bb12cd8364 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Thu, 30 Apr 2015 14:46:24 +1000 Subject: [PATCH] Fixed setup + new plot clearing --- .../intellectualcrafters/plot/commands/Setup.java | 12 +++++++----- .../com/intellectualcrafters/plot/util/MainUtil.java | 10 ++-------- .../plot/util/bukkit/BukkitChunkManager.java | 5 ----- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java index a6da94f11..4131daaf6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java @@ -45,22 +45,24 @@ public class Setup extends SubCommand { } public void displayGenerators(PlotPlayer plr) { - MainUtil.sendMessage(plr, "&6What generator do you want?"); + StringBuffer message = new StringBuffer(); + message.append("&6What generator do you want?"); for (Entry entry : SetupUtils.generators.entrySet()) { // + prefix + StringUtils.join(SetupUtils.generators.keySet(), prefix).replaceAll("PlotSquared", "&2PlotSquared") if (entry.getKey().equals("PlotSquared")) { - MainUtil.sendMessage(plr, "\n&8 - &2" + entry.getKey() + "(Hybrid Generator)"); + message.append("\n&8 - &2" + entry.getKey() + "(Hybrid Generator)"); } else if (entry.getValue() instanceof HybridGen) { - MainUtil.sendMessage(plr, "\n&8 - &7" + entry.getKey() + "(Hybrid Generator)"); + message.append("\n&8 - &7" + entry.getKey() + "(Hybrid Generator)"); } else if (entry.getValue() instanceof PlotGenerator) { - MainUtil.sendMessage(plr, "\n&8 - &7" + entry.getKey() + "(Plot Generator)"); + message.append("\n&8 - &7" + entry.getKey() + "(Plot Generator)"); } else { - MainUtil.sendMessage(plr, "\n&8 - &7" + entry.getKey() + "(Unknown structure)"); + message.append("\n&8 - &7" + entry.getKey() + "(Unknown structure)"); } } + MainUtil.sendMessage(plr, message.toString()); } @Override diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 9e872598e..c7264c4a6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -601,7 +601,6 @@ public class MainUtil { */ public static boolean clearAsPlayer(final Plot plot, final boolean isDelete, final Runnable whenDone) { if (runners.containsKey(plot)) { - System.out.print("RUNNABLE ALREADY"); return false; } ChunkManager.manager.clearAllEntities(plot); @@ -611,7 +610,6 @@ public class MainUtil { } public static void clear(final String world, final Plot plot, final boolean isDelete, final Runnable whenDone) { - System.out.print(1); final PlotManager manager = PlotSquared.getPlotManager(world); final Location pos1 = MainUtil.getPlotBottomLoc(world, plot.id).add(1, 0, 1); final int prime = 31; @@ -622,24 +620,20 @@ public class MainUtil { System.currentTimeMillis(); final PlotWorld plotworld = PlotSquared.getPlotWorld(world); runners.put(plot, 1); - System.out.print(2); if (plotworld.TERRAIN != 0 || Settings.FAST_CLEAR) { final Location pos2 = MainUtil.getPlotTopLoc(world, plot.id); ChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() { @Override public void run() { - System.out.print(3); runners.remove(plot); TaskManager.runTask(whenDone); } }); return; } - System.out.print(2.1); final Runnable run = new Runnable() { @Override public void run() { - System.out.print(3.1); MainUtil.setBiome(world, plot, "FOREST"); runners.remove(plot); TaskManager.runTask(whenDone); @@ -682,7 +676,7 @@ public class MainUtil { setSimpleCuboidAsync(world, pos1, pos2, blocks[0]); return; } - for (int y = pos1.getY(); y < pos2.getY(); y++) { + for (int y = pos1.getY(); y < Math.min(256, pos2.getY()); y++) { for (int x = pos1.getX(); x < pos2.getX(); x++) { for (int z = pos1.getZ(); z < pos2.getZ(); z++) { final int i = random.random(blocks.length); @@ -717,7 +711,7 @@ public class MainUtil { } public static void setSimpleCuboidAsync(final String world, final Location pos1, final Location pos2, final PlotBlock newblock) { - for (int y = pos1.getY(); y < pos2.getY(); y++) { + for (int y = pos1.getY(); y < Math.min(256, pos2.getY()); y++) { for (int x = pos1.getX(); x < pos2.getX(); x++) { for (int z = pos1.getZ(); z < pos2.getZ(); z++) { SetBlockQueue.setBlock(world, x, y, z, newblock); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java index a4fee398e..4884b567c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java @@ -278,9 +278,6 @@ public class BukkitChunkManager extends ChunkManager { final int c1z = c1.getZ(); final int c2x = c2.getX(); final int c2z = c2.getZ(); - - System.out.print(4); - final ArrayList chunks = new ArrayList(); for (int x = c1x; x <= c2x; x++) { for (int z = c1z; z <= c2z; z++) { @@ -297,13 +294,11 @@ public class BukkitChunkManager extends ChunkManager { long start = System.currentTimeMillis(); while (System.currentTimeMillis() - start < 20) { if (chunks.size() == 0) { - System.out.print(5); TaskManager.runTaskLater(whenDone, 1); Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); return; } - System.out.print(6); CURRENT_PLOT_CLEAR = new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ()); final Chunk chunk = chunks.get(0); chunks.remove(0);