From 1c66c985d5b42f5e0f184ab0d032b73c6950d3d7 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Thu, 12 Feb 2015 03:03:17 +1100 Subject: [PATCH] fixed augmented plot clearing modifying nearby plots. --- .../plot/generator/AugmentedPopulator.java | 17 +++++++++++++++-- .../plot/util/ChunkManager.java | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java index d4f55cb3a..affa49569 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java @@ -17,6 +17,8 @@ import com.intellectualcrafters.plot.object.PlotGenerator; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotWorld; +import com.intellectualcrafters.plot.object.RegionWrapper; +import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.PlotHelper; import com.intellectualcrafters.plot.util.TaskManager; @@ -174,8 +176,15 @@ public class AugmentedPopulator extends BlockPopulator { } int xx = x + blockInfo.x; int zz = z + blockInfo.z; - if (p && manager.getPlotIdAbs(plotworld, new Location(world, xx, 0, zz)) != null) { - continue; + if (p) { + if (ChunkManager.CURRENT_PLOT_CLEAR != null) { + if (ChunkManager.isIn(ChunkManager.CURRENT_PLOT_CLEAR, xx, zz)) { + continue; + } + } + else if (manager.getPlotIdAbs(plotworld, new Location(world, xx, 0, zz)) != null) { + continue; + } } PlotHelper.setBlock(world, xx, blockInfo.y, zz, blockInfo.id, (byte) 0); } @@ -184,4 +193,8 @@ public class AugmentedPopulator extends BlockPopulator { populator.populate(world, r,world.getChunkAt(X, Z)); } } + + public boolean isIn(RegionWrapper plot, int x, int z) { + return (x >= plot.minX && x <= plot.maxX && z >= plot.minZ && z <= plot.maxZ); + } } \ No newline at end of file diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java index d8454ac48..2b51ee7f8 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java @@ -261,6 +261,7 @@ public class ChunkManager { entity.spawn(world, x_offset, z_offset); } catch (Exception e) { + System.out.print("Failed to restore entity " + entity.x + "," + entity.y + "," + entity.z + " : " + entity.id); e.printStackTrace(); } }