From 02b2431f776dee7d4914ea4a39bf126a44f307f7 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sat, 25 Jul 2015 15:17:27 +1000 Subject: [PATCH] Fixes #446 --- .../plot/commands/Trim.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Trim.java b/src/main/java/com/intellectualcrafters/plot/commands/Trim.java index 49b10df84..5ea3d5b3d 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Trim.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Trim.java @@ -127,14 +127,22 @@ public class Trim extends SubCommand { PS.get().TASK.cancelTask(Trim.TASK_ID); return; } - final Plot plot = plots.get(0); + final Plot plot = plots.remove(0); plots.remove(0); final Location pos1 = MainUtil.getPlotBottomLoc(world, plot.id); final Location pos2 = MainUtil.getPlotTopLoc(world, plot.id); - for (int x = pos1.getX(); x <= pos2.getX(); x += 512 ) { - for (int z = pos1.getZ(); z <= pos2.getZ(); z += 512 ) { - ChunkLoc chunk = ChunkManager.getChunkChunk(new Location(world, x, 0, z)); - chunks.remove(chunk); + + int ccx1 = (pos1.getX() >> 9); + int ccz1 = (pos1.getZ() >> 9); + int ccx2 = (pos2.getX() >> 9); + int ccz2 = (pos2.getZ() >> 9); + + System.out.print(pos1); + + for(int x = ccx1; x <= ccx2; x++) { + for(int z = ccz1; z <= ccz2; z++) { + chunks.remove(new ChunkLoc(x, z)); + System.out.print(x + "," + z); } } }