diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java index d580719ce..f7e6f16a3 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java @@ -111,8 +111,8 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator { public boolean enqueue() { final Clipboard regenClipboard; if (isRegen()) { - BlockVector3 start = BlockVector3.at(getRegenStart()[0] << 4, getWorld().getMinY(), getRegenStart()[1] << 4); - BlockVector3 end = BlockVector3.at((getRegenEnd()[0] << 4) + 15, getWorld().getMaxY(), (getRegenEnd()[1] << 4) + 15); + BlockVector3 start = BlockVector3.at(getRegenStart()[0] << 4, getMinY(), getRegenStart()[1] << 4); + BlockVector3 end = BlockVector3.at((getRegenEnd()[0] << 4) + 15, getMaxY(), (getRegenEnd()[1] << 4) + 15); Region region = new CuboidRegion(start, end); regenClipboard = new BlockArrayClipboard(region); regenClipboard.setOrigin(start); @@ -134,7 +134,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator { int sx = blockVector2.getX() << 4; int sz = blockVector2.getZ() << 4; if (isRegenChunk) { - for (int layer = (getWorld().getMinY() >> 4); layer <= (getWorld().getMaxY() >> 4); layer++) { + for (int layer = getMinLayer(); layer <= getMaxLayer(); layer++) { for (int y = 0; y < 16; y++) { for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { diff --git a/Core/src/main/java/com/plotsquared/core/queue/LocalChunk.java b/Core/src/main/java/com/plotsquared/core/queue/LocalChunk.java index f8dc61c3f..f992b7e30 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/LocalChunk.java +++ b/Core/src/main/java/com/plotsquared/core/queue/LocalChunk.java @@ -53,8 +53,8 @@ public class LocalChunk { this.parent = parent; this.x = x; this.z = z; - this.minSection = parent.getWorld() != null ? (parent.getWorld().getMinY() >> 4) : 0; - int sections = parent.getWorld() != null ? (parent.getWorld().getMaxY() >> 4) - minSection + 1 : 16; + this.minSection = parent.getMinLayer(); + int sections = parent.getMaxLayer() - parent.getMinLayer() + 1; baseblocks = new BaseBlock[sections][]; biomes = new BiomeType[sections][]; } diff --git a/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java b/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java index 35e7eb7ac..7f01d7b90 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java +++ b/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java @@ -481,4 +481,32 @@ public abstract class QueueCoordinator { } } + /** + * Get the min Y limit associated with the queue + */ + protected int getMinY() { + return getWorld() != null ? getWorld().getMinY() : PlotSquared.platform().versionMinHeight(); + } + + /** + * Get the max Y limit associated with the queue + */ + protected int getMaxY() { + return getWorld() != null ? getWorld().getMinY() : PlotSquared.platform().versionMaxHeight(); + } + + /** + * Get the min chunk layer associated with the queue. Usually 0 or -4; + */ + protected int getMinLayer() { + return (getWorld() != null ? getWorld().getMinY() : PlotSquared.platform().versionMinHeight()) >> 4; + } + + /** + * Get the max chunk layer associated with the queue. Usually 15 or 19 + */ + protected int getMaxLayer() { + return (getWorld() != null ? getWorld().getMinY() : PlotSquared.platform().versionMaxHeight()) >> 4; + } + }