mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 11:13:45 +01:00 
			
		
		
		
	Implement extended world heights into core module
This commit is contained in:
		@@ -65,7 +65,10 @@ final class BlockStatePopulator extends BlockPopulator {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        final ChunkWrapper wrap = new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ());
 | 
			
		||||
        final ScopedQueueCoordinator chunk = this.queue.getForChunk(wrap.x, wrap.z);
 | 
			
		||||
        final ScopedQueueCoordinator chunk = this.queue.getForChunk(wrap.x, wrap.z,
 | 
			
		||||
                com.plotsquared.bukkit.util.BukkitWorld.getMinWorldHeight(world),
 | 
			
		||||
                com.plotsquared.bukkit.util.BukkitWorld.getMaxWorldHeight(world)
 | 
			
		||||
        );
 | 
			
		||||
        if (this.plotGenerator.populateChunk(chunk, area)) {
 | 
			
		||||
            this.queue.enqueue();
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -110,6 +110,11 @@ public class FaweRegionManager extends BukkitRegionManager {
 | 
			
		||||
        delegate.setBiome(region, extendBiome, biome, world, whenDone);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void setBiome(CuboidRegion region, int extendBiome, BiomeType biome, PlotArea area, Runnable whenDone) {
 | 
			
		||||
        delegate.setBiome(region, extendBiome, biome, area.getWorldName(), whenDone);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean copyRegion(
 | 
			
		||||
            final @NonNull Location pos1,
 | 
			
		||||
 
 | 
			
		||||
@@ -1020,8 +1020,8 @@ public class PlotSquared {
 | 
			
		||||
            // save configuration
 | 
			
		||||
 | 
			
		||||
            final List<String> validArguments = Arrays
 | 
			
		||||
                    .asList("s=", "size=", "g=", "gap=", "h=", "height=", "f=", "floor=", "m=", "main=",
 | 
			
		||||
                            "w=", "wall=", "b=", "border="
 | 
			
		||||
                    .asList("s=", "size=", "g=", "gap=", "h=", "height=", "minh=", "minheight=", "maxh=", "maxheight=",
 | 
			
		||||
                            "f=", "floor=", "m=", "main=", "w=", "wall=", "b=", "border="
 | 
			
		||||
                    );
 | 
			
		||||
 | 
			
		||||
            // Calculate the number of expected arguments
 | 
			
		||||
@@ -1100,6 +1100,18 @@ public class PlotSquared {
 | 
			
		||||
                                    ConfigurationUtil.INTEGER.parseString(value).shortValue()
 | 
			
		||||
                            );
 | 
			
		||||
                        }
 | 
			
		||||
                        case "minh", "minheight" -> {
 | 
			
		||||
                            this.worldConfiguration.set(
 | 
			
		||||
                                    base + "world.min_gen_height",
 | 
			
		||||
                                    ConfigurationUtil.INTEGER.parseString(value).shortValue()
 | 
			
		||||
                            );
 | 
			
		||||
                        }
 | 
			
		||||
                        case "maxh", "maxheight" -> {
 | 
			
		||||
                            this.worldConfiguration.set(
 | 
			
		||||
                                    base + "world.max_gen_height",
 | 
			
		||||
                                    ConfigurationUtil.INTEGER.parseString(value).shortValue()
 | 
			
		||||
                            );
 | 
			
		||||
                        }
 | 
			
		||||
                        case "f", "floor" -> this.worldConfiguration.set(
 | 
			
		||||
                                base + "plot.floor",
 | 
			
		||||
                                ConfigurationUtil.BLOCK_BUCKET.parseString(value).toString()
 | 
			
		||||
 
 | 
			
		||||
@@ -75,6 +75,7 @@ import com.sk89q.worldedit.function.operation.Operations;
 | 
			
		||||
import com.sk89q.worldedit.math.BlockVector3;
 | 
			
		||||
import com.sk89q.worldedit.regions.CuboidRegion;
 | 
			
		||||
import com.sk89q.worldedit.regions.Region;
 | 
			
		||||
import com.sk89q.worldedit.world.World;
 | 
			
		||||
import net.kyori.adventure.text.minimessage.Template;
 | 
			
		||||
import org.checkerframework.checker.nullness.qual.NonNull;
 | 
			
		||||
 | 
			
		||||
@@ -191,11 +192,12 @@ public class Area extends SubCommand {
 | 
			
		||||
                final BlockVector3 playerSelectionMin = playerSelectedRegion.getMinimumPoint();
 | 
			
		||||
                final BlockVector3 playerSelectionMax = playerSelectedRegion.getMaximumPoint();
 | 
			
		||||
                // Create a new selection that spans the entire vertical range of the world
 | 
			
		||||
                World world = playerSelectedRegion.getWorld();
 | 
			
		||||
                final CuboidRegion selectedRegion =
 | 
			
		||||
                        new CuboidRegion(
 | 
			
		||||
                                playerSelectedRegion.getWorld(),
 | 
			
		||||
                                BlockVector3.at(playerSelectionMin.getX(), 0, playerSelectionMin.getZ()),
 | 
			
		||||
                                BlockVector3.at(playerSelectionMax.getX(), 255, playerSelectionMax.getZ())
 | 
			
		||||
                                BlockVector3.at(playerSelectionMin.getX(), world.getMinY(), playerSelectionMin.getZ()),
 | 
			
		||||
                                BlockVector3.at(playerSelectionMax.getX(), world.getMaxY(), playerSelectionMax.getZ())
 | 
			
		||||
                        );
 | 
			
		||||
                // There's only one plot in the area...
 | 
			
		||||
                final PlotId plotId = PlotId.of(1, 1);
 | 
			
		||||
@@ -278,9 +280,9 @@ public class Area extends SubCommand {
 | 
			
		||||
                    if (offsetZ != 0) {
 | 
			
		||||
                        this.worldConfiguration.set(path + ".road.offset.z", offsetZ);
 | 
			
		||||
                    }
 | 
			
		||||
                    final String world = this.setupUtils.setupWorld(singleBuilder);
 | 
			
		||||
                    if (this.worldUtil.isWorld(world)) {
 | 
			
		||||
                        PlotSquared.get().loadWorld(world, null);
 | 
			
		||||
                    final String worldName = this.setupUtils.setupWorld(singleBuilder);
 | 
			
		||||
                    if (this.worldUtil.isWorld(worldName)) {
 | 
			
		||||
                        PlotSquared.get().loadWorld(worldName, null);
 | 
			
		||||
                        player.sendMessage(TranslatableCaption.of("single.single_area_created"));
 | 
			
		||||
                    } else {
 | 
			
		||||
                        player.sendMessage(
 | 
			
		||||
 
 | 
			
		||||
@@ -104,8 +104,8 @@ public class Save extends SubCommand {
 | 
			
		||||
                    TaskManager.runTaskAsync(() -> {
 | 
			
		||||
                        String time = (System.currentTimeMillis() / 1000) + "";
 | 
			
		||||
                        Location[] corners = plot.getCorners();
 | 
			
		||||
                        corners[0] = corners[0].withY(0);
 | 
			
		||||
                        corners[1] = corners[1].withY(255);
 | 
			
		||||
                        corners[0] = corners[0].withY(plot.getArea().getMinGenHeight());
 | 
			
		||||
                        corners[1] = corners[1].withY(plot.getArea().getMaxGenHeight());
 | 
			
		||||
                        int size = (corners[1].getX() - corners[0].getX()) + 1;
 | 
			
		||||
                        PlotId id = plot.getId();
 | 
			
		||||
                        String world1 = plot.getArea().toString().replaceAll(";", "-")
 | 
			
		||||
 
 | 
			
		||||
@@ -132,7 +132,7 @@ public class AugmentedUtils {
 | 
			
		||||
                        int worldZ = z + blockZ;
 | 
			
		||||
                        boolean can = manager.getPlotId(worldX, 0, worldZ) == null;
 | 
			
		||||
                        if (can) {
 | 
			
		||||
                            for (int y = 1; y < 128; y++) {
 | 
			
		||||
                            for (int y = area.getMinBuildHeight(); y <= area.getMaxGenHeight(); y++) {
 | 
			
		||||
                                queue.setBlock(worldX, y, worldZ, air);
 | 
			
		||||
                            }
 | 
			
		||||
                            canPlace[x][z] = true;
 | 
			
		||||
@@ -149,7 +149,7 @@ public class AugmentedUtils {
 | 
			
		||||
                secondaryMask = primaryMask;
 | 
			
		||||
                for (int x = relativeBottomX; x <= relativeTopX; x++) {
 | 
			
		||||
                    for (int z = relativeBottomZ; z <= relativeTopZ; z++) {
 | 
			
		||||
                        for (int y = 1; y < 128; y++) {
 | 
			
		||||
                        for (int y = area.getMinBuildHeight(); y <= area.getMaxGenHeight(); y++) {
 | 
			
		||||
                            queue.setBlock(blockX + x, y, blockZ + z, air);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
@@ -166,8 +166,8 @@ public class AugmentedUtils {
 | 
			
		||||
            ScopedQueueCoordinator scoped =
 | 
			
		||||
                    new ScopedQueueCoordinator(
 | 
			
		||||
                            secondaryMask,
 | 
			
		||||
                            Location.at(world, blockX, 0, blockZ),
 | 
			
		||||
                            Location.at(world, blockX + 15, 255, blockZ + 15)
 | 
			
		||||
                            Location.at(world, blockX, area.getMinGenHeight(), blockZ),
 | 
			
		||||
                            Location.at(world, blockX + 15, area.getMaxGenHeight(), blockZ + 15)
 | 
			
		||||
                    );
 | 
			
		||||
            generator.generateChunk(scoped, area);
 | 
			
		||||
            generator.populateChunk(scoped, area);
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,6 @@ import com.plotsquared.core.plot.Plot;
 | 
			
		||||
import com.plotsquared.core.plot.PlotAreaTerrainType;
 | 
			
		||||
import com.plotsquared.core.plot.PlotId;
 | 
			
		||||
import com.plotsquared.core.queue.QueueCoordinator;
 | 
			
		||||
import com.plotsquared.core.util.BlockUtil;
 | 
			
		||||
import com.plotsquared.core.util.MathMan;
 | 
			
		||||
import com.plotsquared.core.util.RegionManager;
 | 
			
		||||
import com.plotsquared.core.util.task.TaskManager;
 | 
			
		||||
@@ -147,7 +146,15 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
    ) {
 | 
			
		||||
        Plot plot = classicPlotWorld.getPlotAbs(plotId);
 | 
			
		||||
        if (plot != null && plot.isBasePlot()) {
 | 
			
		||||
            return this.regionManager.setCuboids(classicPlotWorld, plot.getRegions(), blocks, 1, getWorldHeight(), actor, queue);
 | 
			
		||||
            return this.regionManager.setCuboids(
 | 
			
		||||
                    classicPlotWorld,
 | 
			
		||||
                    plot.getRegions(),
 | 
			
		||||
                    blocks,
 | 
			
		||||
                    1,
 | 
			
		||||
                    classicPlotWorld.getMaxGenHeight(),
 | 
			
		||||
                    actor,
 | 
			
		||||
                    queue
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
@@ -175,7 +182,7 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
                            plot.getRegions(),
 | 
			
		||||
                            blocks,
 | 
			
		||||
                            classicPlotWorld.PLOT_HEIGHT + 1,
 | 
			
		||||
                            getWorldHeight(),
 | 
			
		||||
                            classicPlotWorld.getMaxGenHeight(),
 | 
			
		||||
                            actor,
 | 
			
		||||
                            queue
 | 
			
		||||
                    );
 | 
			
		||||
@@ -281,7 +288,7 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        int maxY = classicPlotWorld.getPlotManager().getWorldHeight();
 | 
			
		||||
        int maxY = classicPlotWorld.getMaxGenHeight();
 | 
			
		||||
        if (!plot.isMerged(Direction.NORTH)) {
 | 
			
		||||
            int z = bottom.getZ();
 | 
			
		||||
            for (int x = bottom.getX(); x <= top.getX(); x++) {
 | 
			
		||||
@@ -501,7 +508,7 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
            enqueue = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        int maxY = getWorldHeight();
 | 
			
		||||
        int maxY = classicPlotWorld.getMaxGenHeight();
 | 
			
		||||
        queue.setCuboid(
 | 
			
		||||
                Location.at(
 | 
			
		||||
                        classicPlotWorld.getWorldName(),
 | 
			
		||||
@@ -513,24 +520,24 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
        );
 | 
			
		||||
        if (classicPlotWorld.PLOT_BEDROCK) {
 | 
			
		||||
            queue.setCuboid(
 | 
			
		||||
                    Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1),
 | 
			
		||||
                    Location.at(classicPlotWorld.getWorldName(), ex, 0, ez - 1),
 | 
			
		||||
                    Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.getMinGenHeight(), sz + 1),
 | 
			
		||||
                    Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getMinGenHeight(), ez - 1),
 | 
			
		||||
                    BlockTypes.BEDROCK.getDefaultState()
 | 
			
		||||
            );
 | 
			
		||||
            queue.setCuboid(
 | 
			
		||||
                    Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1),
 | 
			
		||||
                    Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.getMinGenHeight() + 1, sz + 1),
 | 
			
		||||
                    Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
 | 
			
		||||
                    classicPlotWorld.WALL_FILLING.toPattern()
 | 
			
		||||
            );
 | 
			
		||||
        } else {
 | 
			
		||||
            queue.setCuboid(
 | 
			
		||||
                    Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1),
 | 
			
		||||
                    Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.getMinGenHeight(), sz + 1),
 | 
			
		||||
                    Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
 | 
			
		||||
                    classicPlotWorld.WALL_FILLING.toPattern()
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
        queue.setCuboid(
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1),
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.getMinGenHeight(), sz + 1),
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
 | 
			
		||||
                classicPlotWorld.WALL_FILLING.toPattern()
 | 
			
		||||
        );
 | 
			
		||||
@@ -543,7 +550,7 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
        queue.setCuboid(
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), ex, 1, sz + 1),
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getMinGenHeight() + 1, sz + 1),
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT, ez - 1),
 | 
			
		||||
                classicPlotWorld.WALL_FILLING.toPattern()
 | 
			
		||||
        );
 | 
			
		||||
@@ -555,7 +562,7 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
        queue.setCuboid(
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1),
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.getMinGenHeight() + 1, sz + 1),
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1),
 | 
			
		||||
                classicPlotWorld.ROAD_BLOCK.toPattern()
 | 
			
		||||
        );
 | 
			
		||||
@@ -584,14 +591,16 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
                        classicPlotWorld.schematicStartHeight() + 1,
 | 
			
		||||
                        sz
 | 
			
		||||
                ),
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.getMaxGenHeight(), ez),
 | 
			
		||||
                BlockTypes.AIR.getDefaultState()
 | 
			
		||||
        );
 | 
			
		||||
        queue.setCuboid(
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), sx + 1, 0, sz),
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), ex - 1, 0, ez),
 | 
			
		||||
                BlockUtil.get((short) 7, (byte) 0)
 | 
			
		||||
        );
 | 
			
		||||
        if (classicPlotWorld.PLOT_BEDROCK) {
 | 
			
		||||
            queue.setCuboid(
 | 
			
		||||
                    Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.getMinGenHeight(), sz),
 | 
			
		||||
                    Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.getMinGenHeight(), ez),
 | 
			
		||||
                    BlockTypes.BEDROCK.getDefaultState()
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
        queue.setCuboid(
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz),
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT, sz),
 | 
			
		||||
@@ -642,12 +651,16 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
 | 
			
		||||
        queue.setCuboid(
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.ROAD_HEIGHT + 1, sz + 1),
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), ez - 1),
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.getMaxGenHeight(), ez - 1),
 | 
			
		||||
                BlockTypes.AIR.getDefaultState()
 | 
			
		||||
        );
 | 
			
		||||
        queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 0, sz + 1),
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), ex - 1, 0, ez - 1), BlockUtil.get((short) 7, (byte) 0)
 | 
			
		||||
        );
 | 
			
		||||
        if (classicPlotWorld.PLOT_BEDROCK) {
 | 
			
		||||
            queue.setCuboid(
 | 
			
		||||
                    Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.getMinGenHeight(), sz + 1),
 | 
			
		||||
                    Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.getMinGenHeight(), ez - 1),
 | 
			
		||||
                    BlockTypes.BEDROCK.getDefaultState()
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
        queue.setCuboid(
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1),
 | 
			
		||||
                Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1),
 | 
			
		||||
@@ -679,7 +692,7 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
                                classicPlotWorld.schematicStartHeight() + 1,
 | 
			
		||||
                                sz
 | 
			
		||||
                        ),
 | 
			
		||||
                        Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
 | 
			
		||||
                        Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getMaxGenHeight(), ez),
 | 
			
		||||
                        BlockTypes.AIR.getDefaultState()
 | 
			
		||||
                );
 | 
			
		||||
        queue.setCuboid(
 | 
			
		||||
@@ -719,7 +732,7 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
                                classicPlotWorld.schematicStartHeight() + 1,
 | 
			
		||||
                                sz
 | 
			
		||||
                        ),
 | 
			
		||||
                        Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
 | 
			
		||||
                        Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getMaxGenHeight(), ez),
 | 
			
		||||
                        BlockTypes.AIR.getDefaultState()
 | 
			
		||||
                );
 | 
			
		||||
        queue.setCuboid(
 | 
			
		||||
@@ -758,7 +771,7 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
                                classicPlotWorld.schematicStartHeight() + 1,
 | 
			
		||||
                                sz
 | 
			
		||||
                        ),
 | 
			
		||||
                        Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
 | 
			
		||||
                        Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getMaxGenHeight(), ez),
 | 
			
		||||
                        BlockTypes.AIR.getDefaultState()
 | 
			
		||||
                );
 | 
			
		||||
        queue.setCuboid(
 | 
			
		||||
 
 | 
			
		||||
@@ -127,16 +127,16 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
 | 
			
		||||
    public void loadConfiguration(ConfigurationSection config) {
 | 
			
		||||
        super.loadConfiguration(config);
 | 
			
		||||
        this.PLOT_BEDROCK = config.getBoolean("plot.bedrock");
 | 
			
		||||
        this.PLOT_HEIGHT = Math.min(255, config.getInt("plot.height"));
 | 
			
		||||
        this.PLOT_HEIGHT = Math.min(getMaxGenHeight(), config.getInt("plot.height"));
 | 
			
		||||
        this.MAIN_BLOCK = new BlockBucket(config.getString("plot.filling"));
 | 
			
		||||
        this.TOP_BLOCK = new BlockBucket(config.getString("plot.floor"));
 | 
			
		||||
        this.WALL_BLOCK = new BlockBucket(config.getString("wall.block"));
 | 
			
		||||
        this.ROAD_HEIGHT = Math.min(255, config.getInt("road.height"));
 | 
			
		||||
        this.ROAD_HEIGHT = Math.min(getMaxGenHeight(), config.getInt("road.height"));
 | 
			
		||||
        this.ROAD_BLOCK = new BlockBucket(config.getString("road.block"));
 | 
			
		||||
        this.WALL_FILLING = new BlockBucket(config.getString("wall.filling"));
 | 
			
		||||
        this.WALL_HEIGHT = Math.min(254, config.getInt("wall.height"));
 | 
			
		||||
        this.CLAIMED_WALL_BLOCK = new BlockBucket(config.getString("wall.block_claimed"));
 | 
			
		||||
        this.PLACE_TOP_BLOCK = config.getBoolean("wall.place_top_block");
 | 
			
		||||
        this.WALL_HEIGHT = Math.min(getMaxGenHeight() - (PLACE_TOP_BLOCK ? 1 : 0), config.getInt("wall.height"));
 | 
			
		||||
        this.CLAIMED_WALL_BLOCK = new BlockBucket(config.getString("wall.block_claimed"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    int schematicStartHeight() {
 | 
			
		||||
 
 | 
			
		||||
@@ -91,7 +91,7 @@ public class HybridGen extends IndependentPlotGenerator {
 | 
			
		||||
        if (hybridPlotWorld.PLOT_BEDROCK) {
 | 
			
		||||
            for (short x = 0; x < 16; x++) {
 | 
			
		||||
                for (short z = 0; z < 16; z++) {
 | 
			
		||||
                    result.setBlock(x, 0, z, BlockTypes.BEDROCK.getDefaultState());
 | 
			
		||||
                    result.setBlock(x, hybridPlotWorld.getMinGenHeight(), z, BlockTypes.BEDROCK.getDefaultState());
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -156,7 +156,7 @@ public class HybridGen extends IndependentPlotGenerator {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        // generation
 | 
			
		||||
        int startY = hybridPlotWorld.PLOT_BEDROCK ? 1 : 0;
 | 
			
		||||
        int startY = hybridPlotWorld.getMinGenHeight() + (hybridPlotWorld.PLOT_BEDROCK ? 1: 0);
 | 
			
		||||
        for (short x = 0; x < 16; x++) {
 | 
			
		||||
            if (insideRoadX[x]) {
 | 
			
		||||
                for (short z = 0; z < 16; z++) {
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,6 @@ import com.sk89q.worldedit.function.pattern.Pattern;
 | 
			
		||||
import com.sk89q.worldedit.regions.CuboidRegion;
 | 
			
		||||
import com.sk89q.worldedit.world.biome.BiomeType;
 | 
			
		||||
import com.sk89q.worldedit.world.block.BaseBlock;
 | 
			
		||||
import com.sk89q.worldedit.world.block.BlockState;
 | 
			
		||||
import com.sk89q.worldedit.world.block.BlockTypes;
 | 
			
		||||
import org.checkerframework.checker.nullness.qual.NonNull;
 | 
			
		||||
import org.checkerframework.checker.nullness.qual.Nullable;
 | 
			
		||||
@@ -112,8 +111,18 @@ public class HybridPlotManager extends ClassicPlotManager {
 | 
			
		||||
        PlotId id2 = PlotId.of(id.getX() + 1, id.getY());
 | 
			
		||||
        Location bot = getPlotBottomLocAbs(id2);
 | 
			
		||||
        Location top = getPlotTopLocAbs(id);
 | 
			
		||||
        Location pos1 = Location.at(hybridPlotWorld.getWorldName(), top.getX() + 1, 0, bot.getZ() - 1);
 | 
			
		||||
        Location pos2 = Location.at(hybridPlotWorld.getWorldName(), bot.getX(), Math.min(getWorldHeight(), 255), top.getZ() + 1);
 | 
			
		||||
        Location pos1 = Location.at(
 | 
			
		||||
                hybridPlotWorld.getWorldName(),
 | 
			
		||||
                top.getX() + 1,
 | 
			
		||||
                hybridPlotWorld.getMinGenHeight(),
 | 
			
		||||
                bot.getZ() - 1
 | 
			
		||||
        );
 | 
			
		||||
        Location pos2 = Location.at(
 | 
			
		||||
                hybridPlotWorld.getWorldName(),
 | 
			
		||||
                bot.getX(),
 | 
			
		||||
                hybridPlotWorld.getMaxGenHeight(),
 | 
			
		||||
                top.getZ() + 1
 | 
			
		||||
        );
 | 
			
		||||
        this.resetBiome(hybridPlotWorld, pos1, pos2);
 | 
			
		||||
        if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
 | 
			
		||||
            return true;
 | 
			
		||||
@@ -139,7 +148,7 @@ public class HybridPlotManager extends ClassicPlotManager {
 | 
			
		||||
                        (pos1.getX() + pos2.getX()) / 2,
 | 
			
		||||
                        (pos1.getZ() + pos2.getZ()) / 2
 | 
			
		||||
                ), biome)) {
 | 
			
		||||
            WorldUtil.setBiome(hybridPlotWorld.getWorldName(), pos1.getX(), pos1.getZ(), pos2.getX(), pos2.getZ(), biome);
 | 
			
		||||
            WorldUtil.setBiome(hybridPlotWorld, pos1.getX(), pos1.getZ(), pos2.getX(), pos2.getZ(), biome);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -169,9 +178,10 @@ public class HybridPlotManager extends ClassicPlotManager {
 | 
			
		||||
                }
 | 
			
		||||
                BaseBlock[] blocks = hybridPlotWorld.G_SCH.get(MathMan.pair(absX, absZ));
 | 
			
		||||
                if (blocks != null) {
 | 
			
		||||
                    for (int y = 0; y < blocks.length; y++) {
 | 
			
		||||
                        if (blocks[y] != null) {
 | 
			
		||||
                            queue.setBlock(x, minY + y, z, blocks[y]);
 | 
			
		||||
                    for (int yIndex = 0; yIndex < blocks.length; yIndex++) {
 | 
			
		||||
                        int y = yIndex - hybridPlotWorld.getMinGenHeight();
 | 
			
		||||
                        if (blocks[yIndex] != null) {
 | 
			
		||||
                            queue.setBlock(x, minY + y, z, blocks[yIndex]);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            // This is necessary, otherwise any blocks not specified in the schematic will remain after a clear
 | 
			
		||||
                            queue.setBlock(x, minY + y, z, airBlock);
 | 
			
		||||
@@ -195,8 +205,8 @@ public class HybridPlotManager extends ClassicPlotManager {
 | 
			
		||||
        PlotId id2 = PlotId.of(id.getX(), id.getY() + 1);
 | 
			
		||||
        Location bot = getPlotBottomLocAbs(id2);
 | 
			
		||||
        Location top = getPlotTopLocAbs(id);
 | 
			
		||||
        Location pos1 = Location.at(hybridPlotWorld.getWorldName(), bot.getX() - 1, 0, top.getZ() + 1);
 | 
			
		||||
        Location pos2 = Location.at(hybridPlotWorld.getWorldName(), top.getX() + 1, Math.min(getWorldHeight(), 255), bot.getZ());
 | 
			
		||||
        Location pos1 = Location.at(hybridPlotWorld.getWorldName(), bot.getX() - 1, hybridPlotWorld.getMinGenHeight(), top.getZ() + 1);
 | 
			
		||||
        Location pos2 = Location.at(hybridPlotWorld.getWorldName(), top.getX() + 1, hybridPlotWorld.getMaxGenHeight(), bot.getZ());
 | 
			
		||||
        this.resetBiome(hybridPlotWorld, pos1, pos2);
 | 
			
		||||
        if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
 | 
			
		||||
            return true;
 | 
			
		||||
@@ -215,8 +225,8 @@ public class HybridPlotManager extends ClassicPlotManager {
 | 
			
		||||
        super.createRoadSouthEast(plot, queue);
 | 
			
		||||
        PlotId id = plot.getId();
 | 
			
		||||
        PlotId id2 = PlotId.of(id.getX() + 1, id.getY() + 1);
 | 
			
		||||
        Location pos1 = getPlotTopLocAbs(id).add(1, 0, 1).withY(0);
 | 
			
		||||
        Location pos2 = getPlotBottomLocAbs(id2).withY(Math.min(getWorldHeight(), 255));
 | 
			
		||||
        Location pos1 = getPlotTopLocAbs(id).add(1, 0, 1);
 | 
			
		||||
        Location pos2 = getPlotBottomLocAbs(id2);
 | 
			
		||||
        boolean enqueue = false;
 | 
			
		||||
        if (queue == null) {
 | 
			
		||||
            enqueue = true;
 | 
			
		||||
@@ -271,11 +281,23 @@ public class HybridPlotManager extends ClassicPlotManager {
 | 
			
		||||
            queue.setCompleteTask(whenDone);
 | 
			
		||||
        }
 | 
			
		||||
        if (!canRegen) {
 | 
			
		||||
            queue.setCuboid(pos1.withY(0), pos2.withY(0), bedrock);
 | 
			
		||||
            queue.setCuboid(
 | 
			
		||||
                    pos1.withY(hybridPlotWorld.getMinGenHeight()),
 | 
			
		||||
                    pos2.withY(hybridPlotWorld.getMinGenHeight()),
 | 
			
		||||
                    bedrock
 | 
			
		||||
            );
 | 
			
		||||
            // Each component has a different layer
 | 
			
		||||
            queue.setCuboid(pos1.withY(1), pos2.withY(hybridPlotWorld.PLOT_HEIGHT - 1), filling);
 | 
			
		||||
            queue.setCuboid(
 | 
			
		||||
                    pos1.withY(hybridPlotWorld.getMinGenHeight() + 1),
 | 
			
		||||
                    pos2.withY(hybridPlotWorld.PLOT_HEIGHT - 1),
 | 
			
		||||
                    filling
 | 
			
		||||
            );
 | 
			
		||||
            queue.setCuboid(pos1.withY(hybridPlotWorld.PLOT_HEIGHT), pos2.withY(hybridPlotWorld.PLOT_HEIGHT), plotfloor);
 | 
			
		||||
            queue.setCuboid(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1), pos2.withY(getWorldHeight()), BlockTypes.AIR.getDefaultState());
 | 
			
		||||
            queue.setCuboid(
 | 
			
		||||
                    pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1),
 | 
			
		||||
                    pos2.withY(hybridPlotWorld.getMaxGenHeight()),
 | 
			
		||||
                    BlockTypes.AIR.getDefaultState()
 | 
			
		||||
            );
 | 
			
		||||
            queue.setBiomeCuboid(pos1, pos2, biome);
 | 
			
		||||
        } else {
 | 
			
		||||
            queue.setRegenRegion(new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()));
 | 
			
		||||
 
 | 
			
		||||
@@ -171,9 +171,9 @@ public class HybridPlotWorld extends ClassicPlotWorld {
 | 
			
		||||
    public void loadConfiguration(ConfigurationSection config) {
 | 
			
		||||
        super.loadConfiguration(config);
 | 
			
		||||
        if ((this.ROAD_WIDTH & 1) == 0) {
 | 
			
		||||
            this.PATH_WIDTH_LOWER = (short) (Math.floor(this.ROAD_WIDTH / 2) - 1);
 | 
			
		||||
            this.PATH_WIDTH_LOWER = (short) (Math.floor(this.ROAD_WIDTH / 2f) - 1);
 | 
			
		||||
        } else {
 | 
			
		||||
            this.PATH_WIDTH_LOWER = (short) Math.floor(this.ROAD_WIDTH / 2);
 | 
			
		||||
            this.PATH_WIDTH_LOWER = (short) Math.floor(this.ROAD_WIDTH / 2f);
 | 
			
		||||
        }
 | 
			
		||||
        if (this.ROAD_WIDTH == 0) {
 | 
			
		||||
            this.PATH_WIDTH_UPPER = (short) (this.SIZE + 1);
 | 
			
		||||
@@ -251,31 +251,33 @@ public class HybridPlotWorld extends ClassicPlotWorld {
 | 
			
		||||
        Schematic schematic2 = this.schematicHandler.getSchematic(schematic2File);
 | 
			
		||||
        Schematic schematic3 = this.schematicHandler.getSchematic(schematic3File);
 | 
			
		||||
        int shift = this.ROAD_WIDTH / 2;
 | 
			
		||||
        int oddshift = (this.ROAD_WIDTH & 1) == 0 ? 0 : 1;
 | 
			
		||||
        int oddshift = (this.ROAD_WIDTH & 1);
 | 
			
		||||
 | 
			
		||||
        SCHEM_Y = schematicStartHeight();
 | 
			
		||||
        int plotY = PLOT_HEIGHT - SCHEM_Y;
 | 
			
		||||
        int minRoadWall = Settings.Schematics.USE_WALL_IN_ROAD_SCHEM_HEIGHT ? Math.min(ROAD_HEIGHT, WALL_HEIGHT) : ROAD_HEIGHT;
 | 
			
		||||
        int roadY = minRoadWall - SCHEM_Y;
 | 
			
		||||
 | 
			
		||||
        int worldHeight = getMaxGenHeight() - getMinGenHeight() + 1;
 | 
			
		||||
 | 
			
		||||
        if (schematic3 != null) {
 | 
			
		||||
            if (schematic3.getClipboard().getDimensions().getY() == 256) {
 | 
			
		||||
                SCHEM_Y = plotY = 0;
 | 
			
		||||
            if (schematic3.getClipboard().getDimensions().getY() == worldHeight) {
 | 
			
		||||
                SCHEM_Y = plotY = getMinGenHeight();
 | 
			
		||||
            } else if (!Settings.Schematics.PASTE_ON_TOP) {
 | 
			
		||||
                SCHEM_Y = plotY = getMinBuildHeight();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (schematic1 != null) {
 | 
			
		||||
            if (schematic1.getClipboard().getDimensions().getY() == 256) {
 | 
			
		||||
                SCHEM_Y = roadY = 0;
 | 
			
		||||
                if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != 256
 | 
			
		||||
            if (schematic1.getClipboard().getDimensions().getY() == worldHeight) {
 | 
			
		||||
                SCHEM_Y = roadY = getMinGenHeight();
 | 
			
		||||
                if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != worldHeight
 | 
			
		||||
                        && !Settings.Schematics.PASTE_ON_TOP) {
 | 
			
		||||
                    plotY = PLOT_HEIGHT;
 | 
			
		||||
                }
 | 
			
		||||
            } else if (!Settings.Schematics.PASTE_ROAD_ON_TOP) {
 | 
			
		||||
                SCHEM_Y = roadY = getMinBuildHeight();
 | 
			
		||||
                if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != 256
 | 
			
		||||
                if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != worldHeight
 | 
			
		||||
                        && !Settings.Schematics.PASTE_ON_TOP) {
 | 
			
		||||
                    plotY = PLOT_HEIGHT;
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -145,6 +145,8 @@ public class HybridUtils {
 | 
			
		||||
            final int ctz = tz >> 4;
 | 
			
		||||
            final int width = tx - bx + 1;
 | 
			
		||||
            final int length = tz - bz + 1;
 | 
			
		||||
            final int height = area.getMaxGenHeight() - area.getMinGenHeight();
 | 
			
		||||
            final int minHeight = area.getMinGenHeight();
 | 
			
		||||
 | 
			
		||||
            final PlotArea area = this.plotAreaManager.getPlotArea(world, null);
 | 
			
		||||
 | 
			
		||||
@@ -157,7 +159,7 @@ public class HybridUtils {
 | 
			
		||||
 | 
			
		||||
            final BlockState airBlock = BlockTypes.AIR.getDefaultState();
 | 
			
		||||
            final BlockState[][][] oldBlocks = chunk.getBlocks();
 | 
			
		||||
            final BlockState[][][] newBlocks = new BlockState[256][width][length];
 | 
			
		||||
            final BlockState[][][] newBlocks = new BlockState[height][width][length];
 | 
			
		||||
            for (final BlockState[][] newBlock : newBlocks) {
 | 
			
		||||
                for (final BlockState[] blockStates : newBlock) {
 | 
			
		||||
                    Arrays.fill(blockStates, airBlock);
 | 
			
		||||
@@ -211,11 +213,12 @@ public class HybridUtils {
 | 
			
		||||
                    int xx = chunkBlockX + x;
 | 
			
		||||
                    for (int z = minZ; z <= maxZ; z++) {
 | 
			
		||||
                        int zz = chunkBlockZ + z;
 | 
			
		||||
                        for (int y = 0; y < 256; y++) {
 | 
			
		||||
                        for (int yIndex = 0; yIndex < minHeight; yIndex++) {
 | 
			
		||||
                            int y = yIndex - minHeight;
 | 
			
		||||
                            BlockState block = queue.getBlock(xx, y, zz);
 | 
			
		||||
                            int xr = xb + x;
 | 
			
		||||
                            int zr = zb + z;
 | 
			
		||||
                            newBlocks[y][xr][zr] = block;
 | 
			
		||||
                            newBlocks[yIndex][xr][zr] = block;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
@@ -232,10 +235,10 @@ public class HybridUtils {
 | 
			
		||||
                for (int x = 0; x < width; x++) {
 | 
			
		||||
                    for (int z = 0; z < length; z++) {
 | 
			
		||||
                        Set<BlockType> types = new HashSet<>();
 | 
			
		||||
                        for (int y = 0; y < 256; y++) {
 | 
			
		||||
                            BlockState old = oldBlocks[y][x][z];
 | 
			
		||||
                        for (int yIndex = 0; yIndex < height; yIndex++) {
 | 
			
		||||
                            BlockState old = oldBlocks[yIndex][x][z];
 | 
			
		||||
                            try {
 | 
			
		||||
                                BlockState now = newBlocks[y][x][z];
 | 
			
		||||
                                BlockState now = newBlocks[yIndex][x][z];
 | 
			
		||||
                                if (!old.equals(now)) {
 | 
			
		||||
                                    changes[i]++;
 | 
			
		||||
                                }
 | 
			
		||||
@@ -244,23 +247,23 @@ public class HybridUtils {
 | 
			
		||||
                                } else {
 | 
			
		||||
                                    // check vertices
 | 
			
		||||
                                    // modifications_adjacent
 | 
			
		||||
                                    if (x > 0 && z > 0 && y > 0 && x < width - 1 && z < length - 1 && y < 255) {
 | 
			
		||||
                                        if (newBlocks[y - 1][x][z].getBlockType().getMaterial().isAir()) {
 | 
			
		||||
                                    if (x > 0 && z > 0 && yIndex > 0 && x < width - 1 && z < length - 1 && yIndex < (height - 1)) {
 | 
			
		||||
                                        if (newBlocks[yIndex - 1][x][z].getBlockType().getMaterial().isAir()) {
 | 
			
		||||
                                            faces[i]++;
 | 
			
		||||
                                        }
 | 
			
		||||
                                        if (newBlocks[y][x - 1][z].getBlockType().getMaterial().isAir()) {
 | 
			
		||||
                                        if (newBlocks[yIndex][x - 1][z].getBlockType().getMaterial().isAir()) {
 | 
			
		||||
                                            faces[i]++;
 | 
			
		||||
                                        }
 | 
			
		||||
                                        if (newBlocks[y][x][z - 1].getBlockType().getMaterial().isAir()) {
 | 
			
		||||
                                        if (newBlocks[yIndex][x][z - 1].getBlockType().getMaterial().isAir()) {
 | 
			
		||||
                                            faces[i]++;
 | 
			
		||||
                                        }
 | 
			
		||||
                                        if (newBlocks[y + 1][x][z].getBlockType().getMaterial().isAir()) {
 | 
			
		||||
                                        if (newBlocks[yIndex + 1][x][z].getBlockType().getMaterial().isAir()) {
 | 
			
		||||
                                            faces[i]++;
 | 
			
		||||
                                        }
 | 
			
		||||
                                        if (newBlocks[y][x + 1][z].getBlockType().getMaterial().isAir()) {
 | 
			
		||||
                                        if (newBlocks[yIndex][x + 1][z].getBlockType().getMaterial().isAir()) {
 | 
			
		||||
                                            faces[i]++;
 | 
			
		||||
                                        }
 | 
			
		||||
                                        if (newBlocks[y][x][z + 1].getBlockType().getMaterial().isAir()) {
 | 
			
		||||
                                        if (newBlocks[yIndex][x][z + 1].getBlockType().getMaterial().isAir()) {
 | 
			
		||||
                                            faces[i]++;
 | 
			
		||||
                                        }
 | 
			
		||||
                                    }
 | 
			
		||||
@@ -514,7 +517,6 @@ public class HybridUtils {
 | 
			
		||||
        Location bot = plot.getBottomAbs().subtract(1, 0, 1);
 | 
			
		||||
        Location top = plot.getTopAbs();
 | 
			
		||||
        final HybridPlotWorld plotworld = (HybridPlotWorld) plot.getArea();
 | 
			
		||||
        PlotManager plotManager = plotworld.getPlotManager();
 | 
			
		||||
        // Do not use plotworld#schematicStartHeight() here as we want to restore the pre 6.1.4 way of doing it if
 | 
			
		||||
        //  USE_WALL_IN_ROAD_SCHEM_HEIGHT is false
 | 
			
		||||
        int schemY = Settings.Schematics.USE_WALL_IN_ROAD_SCHEM_HEIGHT ?
 | 
			
		||||
@@ -524,10 +526,10 @@ public class HybridUtils {
 | 
			
		||||
        int sy = Settings.Schematics.PASTE_ROAD_ON_TOP ? schemY : plot.getArea().getMinBuildHeight();
 | 
			
		||||
        int ex = bot.getX();
 | 
			
		||||
        int ez = top.getZ();
 | 
			
		||||
        int ey = get_ey(plotManager, queue, sx, ex, sz, ez, sy);
 | 
			
		||||
        int ey = get_ey(plotworld, queue, sx, ex, sz, ez, sy);
 | 
			
		||||
        int bz = sz - plotworld.ROAD_WIDTH;
 | 
			
		||||
        int tz = sz - 1;
 | 
			
		||||
        int ty = get_ey(plotManager, queue, sx, ex, bz, tz, sy);
 | 
			
		||||
        int ty = get_ey(plotworld, queue, sx, ex, bz, tz, sy);
 | 
			
		||||
 | 
			
		||||
        final Set<CuboidRegion> sideRoad = Collections.singleton(RegionUtil.createRegion(sx, ex, sy, ey, sz, ez));
 | 
			
		||||
        final Set<CuboidRegion> intersection = Collections.singleton(RegionUtil.createRegion(sx, ex, sy, ty, bz, tz));
 | 
			
		||||
@@ -553,11 +555,11 @@ public class HybridUtils {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int get_ey(final PlotManager pm, QueueCoordinator queue, int sx, int ex, int sz, int ez, int sy) {
 | 
			
		||||
    private int get_ey(final HybridPlotWorld hpw, QueueCoordinator queue, int sx, int ex, int sz, int ez, int sy) {
 | 
			
		||||
        int ey = sy;
 | 
			
		||||
        for (int x = sx; x <= ex; x++) {
 | 
			
		||||
            for (int z = sz; z <= ez; z++) {
 | 
			
		||||
                for (int y = sy; y <= pm.getWorldHeight(); y++) {
 | 
			
		||||
                for (int y = sy; y <= hpw.getMaxGenHeight(); y++) {
 | 
			
		||||
                    if (y > ey) {
 | 
			
		||||
                        BlockState block = queue.getBlock(x, y, z);
 | 
			
		||||
                        if (!block.getBlockType().getMaterial().isAir()) {
 | 
			
		||||
@@ -638,29 +640,29 @@ public class HybridUtils {
 | 
			
		||||
                        }
 | 
			
		||||
                        if (condition) {
 | 
			
		||||
                            BaseBlock[] blocks = plotWorld.G_SCH.get(MathMan.pair(absX, absZ));
 | 
			
		||||
                            int minY = Settings.Schematics.PASTE_ROAD_ON_TOP ? plotWorld.SCHEM_Y : 1;
 | 
			
		||||
                            int maxY = Math.max(extend, blocks.length);
 | 
			
		||||
                            for (int y = 0; y < maxY; y++) {
 | 
			
		||||
                                if (y > blocks.length - 1) {
 | 
			
		||||
                            int minY = Settings.Schematics.PASTE_ROAD_ON_TOP ? plotWorld.SCHEM_Y : area.getMinBuildHeight();
 | 
			
		||||
                            int maxDy = Math.max(extend, blocks.length);
 | 
			
		||||
                            for (int dy = 0; dy < maxDy; dy++) {
 | 
			
		||||
                                if (dy > blocks.length - 1) {
 | 
			
		||||
                                    queue.setBlock(
 | 
			
		||||
                                            finalX + X + plotWorld.ROAD_OFFSET_X,
 | 
			
		||||
                                            minY + y,
 | 
			
		||||
                                            minY + dy,
 | 
			
		||||
                                            finalZ + Z + plotWorld.ROAD_OFFSET_Z,
 | 
			
		||||
                                            WEExtent.AIRBASE
 | 
			
		||||
                                    );
 | 
			
		||||
                                } else {
 | 
			
		||||
                                    BaseBlock block = blocks[y];
 | 
			
		||||
                                    BaseBlock block = blocks[dy];
 | 
			
		||||
                                    if (block != null) {
 | 
			
		||||
                                        queue.setBlock(
 | 
			
		||||
                                                finalX + X + plotWorld.ROAD_OFFSET_X,
 | 
			
		||||
                                                minY + y,
 | 
			
		||||
                                                minY + dy,
 | 
			
		||||
                                                finalZ + Z + plotWorld.ROAD_OFFSET_Z,
 | 
			
		||||
                                                block
 | 
			
		||||
                                        );
 | 
			
		||||
                                    } else {
 | 
			
		||||
                                        queue.setBlock(
 | 
			
		||||
                                                finalX + X + plotWorld.ROAD_OFFSET_X,
 | 
			
		||||
                                                minY + y,
 | 
			
		||||
                                                minY + dy,
 | 
			
		||||
                                                finalZ + Z + plotWorld.ROAD_OFFSET_Z,
 | 
			
		||||
                                                WEExtent.AIRBASE
 | 
			
		||||
                                        );
 | 
			
		||||
 
 | 
			
		||||
@@ -96,7 +96,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
 | 
			
		||||
                .floor(squarePlotWorld.ROAD_WIDTH / 2) - 1;
 | 
			
		||||
        int z = (squarePlotWorld.ROAD_OFFSET_Z + (pz * (squarePlotWorld.ROAD_WIDTH + squarePlotWorld.PLOT_WIDTH))) - (int) Math
 | 
			
		||||
                .floor(squarePlotWorld.ROAD_WIDTH / 2) - 1;
 | 
			
		||||
        return Location.at(squarePlotWorld.getWorldName(), x, Math.min(getWorldHeight(), 255), z);
 | 
			
		||||
        return Location.at(squarePlotWorld.getWorldName(), x, squarePlotWorld.getMaxGenHeight(), z);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -260,7 +260,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
 | 
			
		||||
                - (int) Math.floor(squarePlotWorld.ROAD_WIDTH / 2);
 | 
			
		||||
        int z = (squarePlotWorld.ROAD_OFFSET_Z + (pz * (squarePlotWorld.ROAD_WIDTH + squarePlotWorld.PLOT_WIDTH))) - squarePlotWorld.PLOT_WIDTH
 | 
			
		||||
                - (int) Math.floor(squarePlotWorld.ROAD_WIDTH / 2);
 | 
			
		||||
        return Location.at(squarePlotWorld.getWorldName(), x, squarePlotWorld.getMinBuildHeight(), z);
 | 
			
		||||
        return Location.at(squarePlotWorld.getWorldName(), x, squarePlotWorld.getMinGenHeight(), z);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -122,7 +122,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
 | 
			
		||||
 */
 | 
			
		||||
public class Plot {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Deprecated(forRemoval = true, since = "TODO")
 | 
			
		||||
    public static final int MAX_HEIGHT = 256;
 | 
			
		||||
 | 
			
		||||
    private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + Plot.class.getSimpleName());
 | 
			
		||||
@@ -1371,7 +1371,7 @@ public class Plot {
 | 
			
		||||
        int z = largest.getMinimumPoint().getZ() - 1;
 | 
			
		||||
        PlotManager manager = getManager();
 | 
			
		||||
        int y = isLoaded() ? this.worldUtil.getHighestBlockSynchronous(getWorldName(), x, z) : 62;
 | 
			
		||||
        if (area.allowSigns() && (y <= 0 || y >= 255)) {
 | 
			
		||||
        if (area.allowSigns() && (y <= area.getMinGenHeight() || y >= area.getMaxGenHeight())) {
 | 
			
		||||
            y = Math.max(y, manager.getSignLoc(this).getY() - 1);
 | 
			
		||||
        }
 | 
			
		||||
        return Location.at(getWorldName(), x, y + 1, z);
 | 
			
		||||
@@ -1387,7 +1387,7 @@ public class Plot {
 | 
			
		||||
        if (isLoaded()) {
 | 
			
		||||
            this.worldUtil.getHighestBlock(getWorldName(), x, z, y -> {
 | 
			
		||||
                int height = y;
 | 
			
		||||
                if (area.allowSigns() && (y <= 0 || y >= 255)) {
 | 
			
		||||
                if (area.allowSigns() && (y <= area.getMinGenHeight() || y >= area.getMaxGenHeight())) {
 | 
			
		||||
                    height = Math.max(y, manager.getSignLoc(this).getY() - 1);
 | 
			
		||||
                }
 | 
			
		||||
                result.accept(Location.at(getWorldName(), x, height + 1, z));
 | 
			
		||||
@@ -1619,8 +1619,9 @@ public class Plot {
 | 
			
		||||
    public double getVolume() {
 | 
			
		||||
        double count = 0;
 | 
			
		||||
        for (CuboidRegion region : getRegions()) {
 | 
			
		||||
            count += (region.getMaximumPoint().getX() - (double) region.getMinimumPoint().getX() + 1) * (
 | 
			
		||||
                    region.getMaximumPoint().getZ() - (double) region.getMinimumPoint().getZ() + 1) * MAX_HEIGHT;
 | 
			
		||||
            count += (region.getMaximumPoint().getX() - (double) region.getMinimumPoint().getX() + 1) *
 | 
			
		||||
                    (region.getMaximumPoint().getZ() - (double) region.getMinimumPoint().getZ() + 1) *
 | 
			
		||||
                    (area.getMaxGenHeight() - area.getMinGenHeight() + 1);
 | 
			
		||||
        }
 | 
			
		||||
        return count;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -34,8 +34,6 @@ import com.plotsquared.core.configuration.ConfigurationNode;
 | 
			
		||||
import com.plotsquared.core.configuration.ConfigurationSection;
 | 
			
		||||
import com.plotsquared.core.configuration.ConfigurationUtil;
 | 
			
		||||
import com.plotsquared.core.configuration.Settings;
 | 
			
		||||
import com.plotsquared.core.configuration.caption.CaptionUtility;
 | 
			
		||||
import com.plotsquared.core.configuration.caption.LocaleHolder;
 | 
			
		||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
			
		||||
import com.plotsquared.core.configuration.file.YamlConfiguration;
 | 
			
		||||
import com.plotsquared.core.generator.GridPlotWorld;
 | 
			
		||||
@@ -144,8 +142,10 @@ public abstract class PlotArea {
 | 
			
		||||
    private boolean homeAllowNonmember = false;
 | 
			
		||||
    private BlockLoc nonmemberHome;
 | 
			
		||||
    private BlockLoc defaultHome;
 | 
			
		||||
    private int maxBuildHeight = 256;
 | 
			
		||||
    private int maxBuildHeight = 255;
 | 
			
		||||
    private int minBuildHeight = 1;
 | 
			
		||||
    private int maxGenHeight = 255;
 | 
			
		||||
    private int minGenHeight = 0;
 | 
			
		||||
    private GameMode gameMode = GameModes.CREATIVE;
 | 
			
		||||
    private Map<String, PlotExpression> prices = new HashMap<>();
 | 
			
		||||
    private List<String> schematics = new ArrayList<>();
 | 
			
		||||
@@ -361,6 +361,8 @@ public abstract class PlotArea {
 | 
			
		||||
        this.worldBorder = config.getBoolean("world.border");
 | 
			
		||||
        this.maxBuildHeight = config.getInt("world.max_height");
 | 
			
		||||
        this.minBuildHeight = config.getInt("world.min_height");
 | 
			
		||||
        this.minGenHeight = config.getInt("world.min_gen_height");
 | 
			
		||||
        this.maxGenHeight = config.getInt("world.max_gen_height");
 | 
			
		||||
 | 
			
		||||
        switch (config.getString("world.gamemode").toLowerCase()) {
 | 
			
		||||
            case "creative", "c", "1" -> this.gameMode = GameModes.CREATIVE;
 | 
			
		||||
@@ -484,6 +486,8 @@ public abstract class PlotArea {
 | 
			
		||||
        options.put("home.nonmembers", position);
 | 
			
		||||
        options.put("world.max_height", this.getMaxBuildHeight());
 | 
			
		||||
        options.put("world.min_height", this.getMinBuildHeight());
 | 
			
		||||
        options.put("world.min_gen_height", this.getMinGenHeight());
 | 
			
		||||
        options.put("world.max_gen_height", this.getMaxGenHeight());
 | 
			
		||||
        options.put("world.gamemode", this.getGameMode().getName().toLowerCase());
 | 
			
		||||
        options.put("road.flags.default", null);
 | 
			
		||||
 | 
			
		||||
@@ -1078,8 +1082,8 @@ public abstract class PlotArea {
 | 
			
		||||
                    BlockVector2 pos1 = BlockVector2.at(value.getP1().getX(), value.getP1().getY());
 | 
			
		||||
                    BlockVector2 pos2 = BlockVector2.at(value.getP2().getX(), value.getP2().getY());
 | 
			
		||||
                    return new CuboidRegion(
 | 
			
		||||
                            pos1.toBlockVector3(),
 | 
			
		||||
                            pos2.toBlockVector3(Plot.MAX_HEIGHT - 1)
 | 
			
		||||
                            pos1.toBlockVector3(getMinGenHeight()),
 | 
			
		||||
                            pos2.toBlockVector3(getMaxGenHeight())
 | 
			
		||||
                    );
 | 
			
		||||
                }
 | 
			
		||||
            };
 | 
			
		||||
@@ -1361,14 +1365,38 @@ public abstract class PlotArea {
 | 
			
		||||
        this.defaultHome = defaultHome;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the maximum height players may build in. Inclusive.
 | 
			
		||||
     */
 | 
			
		||||
    public int getMaxBuildHeight() {
 | 
			
		||||
        return this.maxBuildHeight;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the minimum height players may build in. Inclusive.
 | 
			
		||||
     */
 | 
			
		||||
    public int getMinBuildHeight() {
 | 
			
		||||
        return this.minBuildHeight;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the min height from which P2 will generate blocks. Inclusive.
 | 
			
		||||
     *
 | 
			
		||||
     * @since TODO
 | 
			
		||||
     */
 | 
			
		||||
    public int getMinGenHeight() {
 | 
			
		||||
        return this.minGenHeight;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the max height to which P2 will generate blocks. Inclusive.
 | 
			
		||||
     *
 | 
			
		||||
     * @since TODO
 | 
			
		||||
     */
 | 
			
		||||
    public int getMaxGenHeight() {
 | 
			
		||||
        return this.maxGenHeight;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public GameMode getGameMode() {
 | 
			
		||||
        return this.gameMode;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -165,7 +165,7 @@ public class PlotCluster {
 | 
			
		||||
        Consumer<Location> locationConsumer = toReturn ->
 | 
			
		||||
                PlotSquared.platform().worldUtil().getHighestBlock(this.area.getWorldName(), toReturn.getX(), toReturn.getZ(),
 | 
			
		||||
                        highest -> {
 | 
			
		||||
                            if (highest == 0) {
 | 
			
		||||
                            if (highest <= area.getMinBuildHeight()) {
 | 
			
		||||
                                highest = 63;
 | 
			
		||||
                            }
 | 
			
		||||
                            if (highest > toReturn.getY()) {
 | 
			
		||||
@@ -175,12 +175,12 @@ public class PlotCluster {
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                );
 | 
			
		||||
        if (home.getY() == 0) {
 | 
			
		||||
        if (home.getY() == Integer.MIN_VALUE) {
 | 
			
		||||
            // default pos
 | 
			
		||||
            Plot center = getCenterPlot();
 | 
			
		||||
            center.getHome(location -> {
 | 
			
		||||
                Location toReturn = location;
 | 
			
		||||
                if (toReturn.getY() == 0) {
 | 
			
		||||
                if (toReturn.getY() <= area.getMinBuildHeight()) {
 | 
			
		||||
                    PlotManager manager = this.area.getPlotManager();
 | 
			
		||||
                    Location locationSign = manager.getSignLoc(center);
 | 
			
		||||
                    toReturn = toReturn.withY(locationSign.getY());
 | 
			
		||||
 
 | 
			
		||||
@@ -69,8 +69,6 @@ import java.util.concurrent.CompletableFuture;
 | 
			
		||||
import java.util.concurrent.atomic.AtomicBoolean;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
import static com.plotsquared.core.plot.Plot.MAX_HEIGHT;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Manager that handles {@link Plot} modifications
 | 
			
		||||
 */
 | 
			
		||||
@@ -311,7 +309,7 @@ public final class PlotModificationManager {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                CuboidRegion region = regions.poll();
 | 
			
		||||
                PlotSquared.platform().regionManager().setBiome(region, extendBiome, biome, plot.getWorldName(), this);
 | 
			
		||||
                PlotSquared.platform().regionManager().setBiome(region, extendBiome, biome, plot.getArea(), this);
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
        run.run();
 | 
			
		||||
@@ -541,8 +539,8 @@ public final class PlotModificationManager {
 | 
			
		||||
            Plot other = this.plot.getRelative(Direction.SOUTH);
 | 
			
		||||
            Location bot = other.getBottomAbs();
 | 
			
		||||
            Location top = this.plot.getTopAbs();
 | 
			
		||||
            Location pos1 = Location.at(this.plot.getWorldName(), bot.getX(), 0, top.getZ());
 | 
			
		||||
            Location pos2 = Location.at(this.plot.getWorldName(), top.getX(), MAX_HEIGHT, bot.getZ());
 | 
			
		||||
            Location pos1 = Location.at(this.plot.getWorldName(), bot.getX(), plot.getArea().getMinGenHeight(), top.getZ());
 | 
			
		||||
            Location pos2 = Location.at(this.plot.getWorldName(), top.getX(), plot.getArea().getMaxGenHeight() + 1, bot.getZ());
 | 
			
		||||
            PlotSquared.platform().regionManager().regenerateRegion(pos1, pos2, true, null);
 | 
			
		||||
        } else if (this.plot.getArea().getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove
 | 
			
		||||
            this.plot.getManager().removeRoadSouth(this.plot, queue);
 | 
			
		||||
@@ -929,8 +927,8 @@ public final class PlotModificationManager {
 | 
			
		||||
            Plot other = this.plot.getRelative(Direction.EAST);
 | 
			
		||||
            Location bot = other.getBottomAbs();
 | 
			
		||||
            Location top = this.plot.getTopAbs();
 | 
			
		||||
            Location pos1 = Location.at(this.plot.getWorldName(), top.getX(), 0, bot.getZ());
 | 
			
		||||
            Location pos2 = Location.at(this.plot.getWorldName(), bot.getX(), MAX_HEIGHT, top.getZ());
 | 
			
		||||
            Location pos1 = Location.at(this.plot.getWorldName(), top.getX(), plot.getArea().getMinGenHeight(), bot.getZ());
 | 
			
		||||
            Location pos2 = Location.at(this.plot.getWorldName(), bot.getX(), plot.getArea().getMaxGenHeight() + 1, top.getZ());
 | 
			
		||||
            PlotSquared.platform().regionManager().regenerateRegion(pos1, pos2, true, null);
 | 
			
		||||
        } else if (this.plot.getArea().getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove
 | 
			
		||||
            this.plot.getArea().getPlotManager().removeRoadEast(this.plot, queue);
 | 
			
		||||
@@ -948,8 +946,8 @@ public final class PlotModificationManager {
 | 
			
		||||
                .getArea()
 | 
			
		||||
                .getTerrain() == PlotAreaTerrainType.ROAD) {
 | 
			
		||||
            Plot other = this.plot.getRelative(1, 1);
 | 
			
		||||
            Location pos1 = this.plot.getTopAbs().add(1, 0, 1).withY(0);
 | 
			
		||||
            Location pos2 = other.getBottomAbs().subtract(1, 0, 1).withY(MAX_HEIGHT);
 | 
			
		||||
            Location pos1 = this.plot.getTopAbs().add(1, 0, 1);
 | 
			
		||||
            Location pos2 = other.getBottomAbs().subtract(1, 0, 1);
 | 
			
		||||
            PlotSquared.platform().regionManager().regenerateRegion(pos1, pos2, true, null);
 | 
			
		||||
        } else if (this.plot.getArea().getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove
 | 
			
		||||
            this.plot.getArea().getPlotManager().removeRoadSouthEast(this.plot, queue);
 | 
			
		||||
 
 | 
			
		||||
@@ -101,7 +101,7 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean setBlock(int x, int y, int z, @NonNull BaseBlock id) {
 | 
			
		||||
        if ((y > 255) || (y < 0)) {
 | 
			
		||||
        if ((y > world.getMaxY()) || (y < world.getMinY())) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        LocalChunk chunk = getChunk(x >> 4, z >> 4);
 | 
			
		||||
@@ -121,7 +121,7 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean setBiome(int x, int z, @NonNull BiomeType biomeType) {
 | 
			
		||||
        LocalChunk chunk = getChunk(x >> 4, z >> 4);
 | 
			
		||||
        for (int y = 0; y < 256; y++) {
 | 
			
		||||
        for (int y = world.getMinY(); y <= world.getMaxY(); y++) {
 | 
			
		||||
            chunk.setBiome(x & 15, y, z & 15, biomeType);
 | 
			
		||||
        }
 | 
			
		||||
        settingBiomes = true;
 | 
			
		||||
 
 | 
			
		||||
@@ -54,12 +54,12 @@ public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
 | 
			
		||||
            @NonNull BlockVector3 top,
 | 
			
		||||
            boolean biomes
 | 
			
		||||
    ) {
 | 
			
		||||
        super(null, Location.at("", 0, 0, 0), Location.at("", 15, 255, 15));
 | 
			
		||||
        super(null, Location.at("", 0, weWorld.getMinY(), 0), Location.at("", 15, weWorld.getMaxY(), 15));
 | 
			
		||||
        this.weWorld = weWorld;
 | 
			
		||||
        this.width = top.getX() - bot.getX() + 1;
 | 
			
		||||
        this.length = top.getZ() - bot.getZ() + 1;
 | 
			
		||||
        this.result = new BlockState[256][width][length];
 | 
			
		||||
        this.biomeResult = biomes ? new BiomeType[256][width][length] : null;
 | 
			
		||||
        this.result = new BlockState[weWorld.getMaxY() - weWorld.getMinY() + 1][width][length];
 | 
			
		||||
        this.biomeResult = biomes ? new BiomeType[weWorld.getMaxY() - weWorld.getMinY() + 1][width][length] : null;
 | 
			
		||||
        this.bot = bot;
 | 
			
		||||
        this.top = top;
 | 
			
		||||
    }
 | 
			
		||||
@@ -71,7 +71,7 @@ public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean setBiome(int x, int z, @NonNull BiomeType biomeType) {
 | 
			
		||||
        if (this.biomeResult != null) {
 | 
			
		||||
            for (int y = 0; y < 256; y++) {
 | 
			
		||||
            for (int y = weWorld.getMinY(); y <= weWorld.getMaxY(); y++) {
 | 
			
		||||
                this.storeCacheBiome(x, y, z, biomeType);
 | 
			
		||||
            }
 | 
			
		||||
            return true;
 | 
			
		||||
@@ -101,9 +101,10 @@ public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void storeCache(final int x, final int y, final int z, final @NonNull BlockState id) {
 | 
			
		||||
        BlockState[][] resultY = result[y];
 | 
			
		||||
        int yIndex = y - weWorld.getMinY();
 | 
			
		||||
        BlockState[][] resultY = result[yIndex];
 | 
			
		||||
        if (resultY == null) {
 | 
			
		||||
            result[y] = resultY = new BlockState[length][];
 | 
			
		||||
            result[yIndex] = resultY = new BlockState[length][];
 | 
			
		||||
        }
 | 
			
		||||
        BlockState[] resultYZ = resultY[z];
 | 
			
		||||
        if (resultYZ == null) {
 | 
			
		||||
@@ -113,9 +114,10 @@ public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void storeCacheBiome(final int x, final int y, final int z, final @NonNull BiomeType id) {
 | 
			
		||||
        BiomeType[][] resultY = biomeResult[y];
 | 
			
		||||
        int yIndex = y - weWorld.getMinY();
 | 
			
		||||
        BiomeType[][] resultY = biomeResult[yIndex];
 | 
			
		||||
        if (resultY == null) {
 | 
			
		||||
            biomeResult[y] = resultY = new BiomeType[length][];
 | 
			
		||||
            biomeResult[yIndex] = resultY = new BiomeType[length][];
 | 
			
		||||
        }
 | 
			
		||||
        BiomeType[] resultYZ = resultY[z];
 | 
			
		||||
        if (resultYZ == null) {
 | 
			
		||||
@@ -132,7 +134,7 @@ public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public @Nullable BlockState getBlock(int x, int y, int z) {
 | 
			
		||||
        BlockState[][] blocksY = result[y];
 | 
			
		||||
        BlockState[][] blocksY = result[y - weWorld.getMinY()];
 | 
			
		||||
        if (blocksY != null) {
 | 
			
		||||
            BlockState[] blocksYZ = blocksY[z];
 | 
			
		||||
            if (blocksYZ != null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -87,11 +87,14 @@ public class LocationOffsetDelegateQueueCoordinator extends DelegateQueueCoordin
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean setBiome(int x, int z, @NonNull BiomeType biome) {
 | 
			
		||||
        boolean result = true;
 | 
			
		||||
        for (int y = 0; y < 256; y++) {
 | 
			
		||||
            result &= this.setBiome(x, y, z, biome);
 | 
			
		||||
        try {
 | 
			
		||||
            if (canPlace[x - blockX][z - blockZ]) {
 | 
			
		||||
                return super.setBiome(x, z, biome);
 | 
			
		||||
            }
 | 
			
		||||
        } catch (final Exception e) {
 | 
			
		||||
            throw e;
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
 
 | 
			
		||||
@@ -75,12 +75,25 @@ public abstract class QueueCoordinator {
 | 
			
		||||
     * @param x chunk x coordinate
 | 
			
		||||
     * @param z chunk z coordinate
 | 
			
		||||
     * @return a new {@link ScopedQueueCoordinator}
 | 
			
		||||
     * @deprecated Use {@link ScopedQueueCoordinator#getForChunk(int, int, int, int)}
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated(forRemoval = true, since = "TODO")
 | 
			
		||||
    public ScopedQueueCoordinator getForChunk(int x, int z) {
 | 
			
		||||
        return getForChunk(x, z, 0, 255);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get a {@link ScopedQueueCoordinator} limited to the chunk at the specific chunk Coordinates
 | 
			
		||||
     *
 | 
			
		||||
     * @param x chunk x coordinate
 | 
			
		||||
     * @param z chunk z coordinate
 | 
			
		||||
     * @return a new {@link ScopedQueueCoordinator}
 | 
			
		||||
     */
 | 
			
		||||
    public ScopedQueueCoordinator getForChunk(int x, int z, int minY, int maxY) {
 | 
			
		||||
        int bx = x << 4;
 | 
			
		||||
        int bz = z << 4;
 | 
			
		||||
        return new ScopedQueueCoordinator(this, Location.at(getWorld().getName(), bx, 0, bz),
 | 
			
		||||
                Location.at(getWorld().getName(), bx + 15, 255, bz + 255)
 | 
			
		||||
        return new ScopedQueueCoordinator(this, Location.at(getWorld().getName(), bx, minY, bz),
 | 
			
		||||
                Location.at(getWorld().getName(), bx + 15, maxY, bz + 15)
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -404,7 +417,7 @@ public abstract class QueueCoordinator {
 | 
			
		||||
     */
 | 
			
		||||
    public void setCuboid(@NonNull Location pos1, @NonNull Location pos2, @NonNull BlockState block) {
 | 
			
		||||
        int yMin = Math.min(pos1.getY(), pos2.getY());
 | 
			
		||||
        int yMax = Math.min(255, Math.max(pos1.getY(), pos2.getY()));
 | 
			
		||||
        int yMax = Math.max(pos1.getY(), pos2.getY());
 | 
			
		||||
        int xMin = Math.min(pos1.getX(), pos2.getX());
 | 
			
		||||
        int xMax = Math.max(pos1.getX(), pos2.getX());
 | 
			
		||||
        int zMin = Math.min(pos1.getZ(), pos2.getZ());
 | 
			
		||||
@@ -427,7 +440,7 @@ public abstract class QueueCoordinator {
 | 
			
		||||
     */
 | 
			
		||||
    public void setCuboid(@NonNull Location pos1, @NonNull Location pos2, @NonNull Pattern blocks) {
 | 
			
		||||
        int yMin = Math.min(pos1.getY(), pos2.getY());
 | 
			
		||||
        int yMax = Math.min(255, Math.max(pos1.getY(), pos2.getY()));
 | 
			
		||||
        int yMax = Math.max(pos1.getY(), pos2.getY());
 | 
			
		||||
        int xMin = Math.min(pos1.getX(), pos2.getX());
 | 
			
		||||
        int xMax = Math.max(pos1.getX(), pos2.getX());
 | 
			
		||||
        int zMin = Math.min(pos1.getZ(), pos2.getZ());
 | 
			
		||||
@@ -450,7 +463,7 @@ public abstract class QueueCoordinator {
 | 
			
		||||
     */
 | 
			
		||||
    public void setBiomeCuboid(@NonNull Location pos1, @NonNull Location pos2, @NonNull BiomeType biome) {
 | 
			
		||||
        int yMin = Math.min(pos1.getY(), pos2.getY());
 | 
			
		||||
        int yMax = Math.min(255, Math.max(pos1.getY(), pos2.getY()));
 | 
			
		||||
        int yMax = Math.max(pos1.getY(), pos2.getY());
 | 
			
		||||
        int xMin = Math.min(pos1.getX(), pos2.getX());
 | 
			
		||||
        int xMax = Math.max(pos1.getX(), pos2.getX());
 | 
			
		||||
        int zMin = Math.min(pos1.getZ(), pos2.getZ());
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,7 @@ import com.plotsquared.core.queue.QueueCoordinator;
 | 
			
		||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
 | 
			
		||||
import com.plotsquared.core.util.task.RunnableVal;
 | 
			
		||||
import com.sk89q.worldedit.math.BlockVector2;
 | 
			
		||||
import com.sk89q.worldedit.world.World;
 | 
			
		||||
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.concurrent.CompletableFuture;
 | 
			
		||||
@@ -47,18 +48,16 @@ public abstract class ChunkManager {
 | 
			
		||||
            String world,
 | 
			
		||||
            BlockVector2 loc
 | 
			
		||||
    ) {
 | 
			
		||||
        QueueCoordinator queue = PlotSquared.platform().globalBlockQueue().getNewQueue(PlotSquared
 | 
			
		||||
                .platform()
 | 
			
		||||
                .worldUtil()
 | 
			
		||||
                .getWeWorld(world));
 | 
			
		||||
        World weWorld = PlotSquared.platform().worldUtil().getWeWorld(world);
 | 
			
		||||
        QueueCoordinator queue = PlotSquared.platform().globalBlockQueue().getNewQueue(weWorld);
 | 
			
		||||
        if (PlotSquared.get().getPlotAreaManager().isAugmented(world) && PlotSquared.get().isNonStandardGeneration(world, loc)) {
 | 
			
		||||
            int blockX = loc.getX() << 4;
 | 
			
		||||
            int blockZ = loc.getZ() << 4;
 | 
			
		||||
            ScopedQueueCoordinator scoped =
 | 
			
		||||
                    new ScopedQueueCoordinator(
 | 
			
		||||
                            queue,
 | 
			
		||||
                            Location.at(world, blockX, 0, blockZ),
 | 
			
		||||
                            Location.at(world, blockX + 15, 255, blockZ + 15)
 | 
			
		||||
                            Location.at(world, blockX, weWorld.getMinY(), blockZ),
 | 
			
		||||
                            Location.at(world, blockX + 15, weWorld.getMaxY(), blockZ + 15)
 | 
			
		||||
                    );
 | 
			
		||||
            if (force != null) {
 | 
			
		||||
                force.run(scoped);
 | 
			
		||||
 
 | 
			
		||||
@@ -37,15 +37,21 @@ public class MainUtil {
 | 
			
		||||
     * Cache of mapping x,y,z coordinates to the chunk array<br>
 | 
			
		||||
     * - Used for efficient world generation<br>
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated(forRemoval = true, since = "6.0.0")
 | 
			
		||||
    public static short[][] x_loc;
 | 
			
		||||
    @Deprecated(forRemoval = true, since = "6.0.0")
 | 
			
		||||
    public static short[][] y_loc;
 | 
			
		||||
    @Deprecated(forRemoval = true, since = "6.0.0")
 | 
			
		||||
    public static short[][] z_loc;
 | 
			
		||||
    @Deprecated(forRemoval = true, since = "6.0.0")
 | 
			
		||||
    public static short[][][] CACHE_I = null;
 | 
			
		||||
    @Deprecated(forRemoval = true, since = "6.0.0")
 | 
			
		||||
    public static short[][][] CACHE_J = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This cache is used for world generation and just saves a bit of calculation time when checking if something is in the plot area.
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated(forRemoval = true, since = "6.0.0")
 | 
			
		||||
    public static void initCache() {
 | 
			
		||||
        if (x_loc == null) {
 | 
			
		||||
            x_loc = new short[16][4096];
 | 
			
		||||
 
 | 
			
		||||
@@ -279,7 +279,10 @@ public abstract class RegionManager {
 | 
			
		||||
        fromQueue1.addReadChunks(new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()).getChunks());
 | 
			
		||||
        fromQueue2.addReadChunks(new CuboidRegion(
 | 
			
		||||
                swapPos.getBlockVector3(),
 | 
			
		||||
                BlockVector3.at(swapPos.getX() + pos2.getX() - pos1.getX(), 0, swapPos.getZ() + pos2.getZ() - pos1.getZ())
 | 
			
		||||
                BlockVector3.at(swapPos.getX() + pos2.getX() - pos1.getX(),
 | 
			
		||||
                        pos1.getY(),
 | 
			
		||||
                        swapPos.getZ() + pos2.getZ() - pos1.getZ()
 | 
			
		||||
                )
 | 
			
		||||
        ).getChunks());
 | 
			
		||||
        QueueCoordinator toQueue1 = blockQueue.getNewQueue(world1);
 | 
			
		||||
        QueueCoordinator toQueue2 = blockQueue.getNewQueue(world2);
 | 
			
		||||
@@ -352,7 +355,7 @@ public abstract class RegionManager {
 | 
			
		||||
            int bz = Math.max(pos1.getZ(), cbz) & 15;
 | 
			
		||||
            int tx = Math.min(pos2.getX(), cbx + 15) & 15;
 | 
			
		||||
            int tz = Math.min(pos2.getZ(), cbz + 15) & 15;
 | 
			
		||||
            for (int y = 0; y < 256; y++) {
 | 
			
		||||
            for (int y = world1.getMinY(); y <= world1.getMaxY(); y++) {
 | 
			
		||||
                for (int x = bx; x <= tx; x++) {
 | 
			
		||||
                    for (int z = bz; z <= tz; z++) {
 | 
			
		||||
                        int rx = cbx + x;
 | 
			
		||||
@@ -363,7 +366,10 @@ public abstract class RegionManager {
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            Region region = new CuboidRegion(BlockVector3.at(cbx + bx, 0, cbz + bz), BlockVector3.at(cbx + tx, 255, cbz + tz));
 | 
			
		||||
            Region region = new CuboidRegion(
 | 
			
		||||
                    BlockVector3.at(cbx + bx, world1.getMinY(), cbz + bz),
 | 
			
		||||
                    BlockVector3.at(cbx + tx, world1.getMaxY(), cbz + tz)
 | 
			
		||||
            );
 | 
			
		||||
            toQueue.addEntities(world1.getEntities(region));
 | 
			
		||||
            if (removeEntities) {
 | 
			
		||||
                for (Entity entity : world1.getEntities(region)) {
 | 
			
		||||
@@ -373,28 +379,39 @@ public abstract class RegionManager {
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Deprecated(forRemoval = true, since = "TODO")
 | 
			
		||||
    public void setBiome(
 | 
			
		||||
            final CuboidRegion region,
 | 
			
		||||
            final int extendBiome,
 | 
			
		||||
            final BiomeType biome,
 | 
			
		||||
            final String world,
 | 
			
		||||
            final Runnable whenDone
 | 
			
		||||
    ) {
 | 
			
		||||
        setBiome(region, extendBiome, biome, PlotSquared.get().getPlotAreaManager().getPlotAreas(world, region)[0], whenDone);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setBiome(
 | 
			
		||||
            final CuboidRegion region,
 | 
			
		||||
            final int extendBiome,
 | 
			
		||||
            final BiomeType biome,
 | 
			
		||||
            final PlotArea area,
 | 
			
		||||
            final Runnable whenDone
 | 
			
		||||
    ) {
 | 
			
		||||
        Location pos1 = Location
 | 
			
		||||
                .at(
 | 
			
		||||
                        world,
 | 
			
		||||
                        area.getWorldName(),
 | 
			
		||||
                        region.getMinimumPoint().getX() - extendBiome,
 | 
			
		||||
                        region.getMinimumPoint().getY(),
 | 
			
		||||
                        region.getMinimumPoint().getZ() - extendBiome
 | 
			
		||||
                );
 | 
			
		||||
        Location pos2 = Location
 | 
			
		||||
                .at(
 | 
			
		||||
                        world,
 | 
			
		||||
                        area.getWorldName(),
 | 
			
		||||
                        region.getMaximumPoint().getX() + extendBiome,
 | 
			
		||||
                        region.getMaximumPoint().getY(),
 | 
			
		||||
                        region.getMaximumPoint().getZ() + extendBiome
 | 
			
		||||
                );
 | 
			
		||||
        final QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(world));
 | 
			
		||||
        final QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(area.getWorldName()));
 | 
			
		||||
 | 
			
		||||
        final int minX = pos1.getX();
 | 
			
		||||
        final int minZ = pos1.getZ();
 | 
			
		||||
@@ -405,14 +422,14 @@ public abstract class RegionManager {
 | 
			
		||||
            final int cx = blockVector2.getX() << 4;
 | 
			
		||||
            final int cz = blockVector2.getZ() << 4;
 | 
			
		||||
            WorldUtil.setBiome(
 | 
			
		||||
                    world,
 | 
			
		||||
                    area,
 | 
			
		||||
                    Math.max(minX, cx),
 | 
			
		||||
                    Math.max(minZ, cz),
 | 
			
		||||
                    Math.min(maxX, cx + 15),
 | 
			
		||||
                    Math.min(maxZ, cz + 15),
 | 
			
		||||
                    biome
 | 
			
		||||
            );
 | 
			
		||||
            worldUtil.refreshChunk(blockVector2.getBlockX(), blockVector2.getBlockZ(), world);
 | 
			
		||||
            worldUtil.refreshChunk(blockVector2.getBlockX(), blockVector2.getBlockZ(), area.getWorldName());
 | 
			
		||||
        });
 | 
			
		||||
        queue.setCompleteTask(whenDone);
 | 
			
		||||
        queue.enqueue();
 | 
			
		||||
 
 | 
			
		||||
@@ -76,8 +76,9 @@ public class RegionUtil {
 | 
			
		||||
        return new CuboidRegion(min, max);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Deprecated(forRemoval = true, since = "TODO")
 | 
			
		||||
    public static CuboidRegion createRegion(int pos1x, int pos2x, int pos1z, int pos2z) {
 | 
			
		||||
        return createRegion(pos1x, pos2x, 0, Plot.MAX_HEIGHT - 1, pos1z, pos2z);
 | 
			
		||||
        return createRegion(pos1x, pos2x, 0, 255, pos1z, pos2z);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static CuboidRegion createRegion(
 | 
			
		||||
 
 | 
			
		||||
@@ -305,12 +305,13 @@ public abstract class SchematicHandler {
 | 
			
		||||
            final int WIDTH = dimension.getX();
 | 
			
		||||
            final int LENGTH = dimension.getZ();
 | 
			
		||||
            final int HEIGHT = dimension.getY();
 | 
			
		||||
            final int worldHeight = plot.getArea().getMaxGenHeight() - plot.getArea().getMinGenHeight() + 1;
 | 
			
		||||
            // Validate dimensions
 | 
			
		||||
            CuboidRegion region = plot.getLargestRegion();
 | 
			
		||||
            boolean sizeMismatch =
 | 
			
		||||
                    ((region.getMaximumPoint().getX() - region.getMinimumPoint().getX() + xOffset + 1) < WIDTH) || (
 | 
			
		||||
                            (region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset + 1) < LENGTH) || (HEIGHT
 | 
			
		||||
                            > 256);
 | 
			
		||||
                            > worldHeight);
 | 
			
		||||
            if (!Settings.Schematics.PASTE_MISMATCHES && sizeMismatch) {
 | 
			
		||||
                actor.sendMessage(TranslatableCaption.of("schematics.schematic_size_mismatch"));
 | 
			
		||||
                TaskManager.runTask(whenDone);
 | 
			
		||||
@@ -321,7 +322,7 @@ public abstract class SchematicHandler {
 | 
			
		||||
            // Calculate the optimal height to paste the schematic at
 | 
			
		||||
            final int y_offset_actual;
 | 
			
		||||
            if (autoHeight) {
 | 
			
		||||
                if (HEIGHT >= 256) {
 | 
			
		||||
                if (HEIGHT >= worldHeight) {
 | 
			
		||||
                    y_offset_actual = yOffset;
 | 
			
		||||
                } else {
 | 
			
		||||
                    PlotArea pw = plot.getArea();
 | 
			
		||||
@@ -360,9 +361,9 @@ public abstract class SchematicHandler {
 | 
			
		||||
            // Paste schematic here
 | 
			
		||||
            final QueueCoordinator queue = plot.getArea().getQueue();
 | 
			
		||||
 | 
			
		||||
            for (int ry = 0; ry < Math.min(256, HEIGHT); ry++) {
 | 
			
		||||
            for (int ry = 0; ry < Math.min(worldHeight, HEIGHT); ry++) {
 | 
			
		||||
                int yy = y_offset_actual + ry;
 | 
			
		||||
                if (yy > 255 || yy < 0) {
 | 
			
		||||
                if (yy > plot.getArea().getMaxGenHeight() || yy < plot.getArea().getMinGenHeight()) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                for (int rz = 0; rz < blockArrayClipboard.getDimensions().getZ(); rz++) {
 | 
			
		||||
@@ -379,10 +380,8 @@ public abstract class SchematicHandler {
 | 
			
		||||
                        BlockVector3 loc = BlockVector3.at(rx, ry, rz);
 | 
			
		||||
                        BaseBlock id = blockArrayClipboard.getFullBlock(loc);
 | 
			
		||||
                        queue.setBlock(xx, yy, zz, id);
 | 
			
		||||
                        if (ry == 0) {
 | 
			
		||||
                            BiomeType biome = blockArrayClipboard.getBiome(loc);
 | 
			
		||||
                            queue.setBiome(xx, yy, zz, biome);
 | 
			
		||||
                        }
 | 
			
		||||
                        BiomeType biome = blockArrayClipboard.getBiome(loc);
 | 
			
		||||
                        queue.setBiome(xx, yy, zz, biome);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -30,6 +30,7 @@ import com.plotsquared.core.configuration.caption.Caption;
 | 
			
		||||
import com.plotsquared.core.location.Location;
 | 
			
		||||
import com.plotsquared.core.player.PlotPlayer;
 | 
			
		||||
import com.plotsquared.core.plot.Plot;
 | 
			
		||||
import com.plotsquared.core.plot.PlotArea;
 | 
			
		||||
import com.plotsquared.core.util.task.RunnableVal;
 | 
			
		||||
import com.sk89q.jnbt.CompoundTag;
 | 
			
		||||
import com.sk89q.jnbt.IntTag;
 | 
			
		||||
@@ -81,11 +82,28 @@ public abstract class WorldUtil {
 | 
			
		||||
     */
 | 
			
		||||
    public static void setBiome(String world, int p1x, int p1z, int p2x, int p2z, BiomeType biome) {
 | 
			
		||||
        BlockVector3 pos1 = BlockVector2.at(p1x, p1z).toBlockVector3();
 | 
			
		||||
        BlockVector3 pos2 = BlockVector2.at(p2x, p2z).toBlockVector3(Plot.MAX_HEIGHT - 1);
 | 
			
		||||
        BlockVector3 pos2 = BlockVector2.at(p2x, p2z).toBlockVector3(255);
 | 
			
		||||
        CuboidRegion region = new CuboidRegion(pos1, pos2);
 | 
			
		||||
        PlotSquared.platform().worldUtil().setBiomes(world, region, biome);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set the biome in a region
 | 
			
		||||
     *
 | 
			
		||||
     * @param area  Plot area
 | 
			
		||||
     * @param p1x   Min X
 | 
			
		||||
     * @param p1z   Min Z
 | 
			
		||||
     * @param p2x   Max X
 | 
			
		||||
     * @param p2z   Max Z
 | 
			
		||||
     * @param biome Biome
 | 
			
		||||
     */
 | 
			
		||||
    public static void setBiome(PlotArea area, int p1x, int p1z, int p2x, int p2z, BiomeType biome) {
 | 
			
		||||
        BlockVector3 pos1 = BlockVector2.at(p1x, p1z).toBlockVector3(area.getMinGenHeight());
 | 
			
		||||
        BlockVector3 pos2 = BlockVector2.at(p2x, p2z).toBlockVector3(area.getMaxGenHeight());
 | 
			
		||||
        CuboidRegion region = new CuboidRegion(pos1, pos2);
 | 
			
		||||
        PlotSquared.platform().worldUtil().setBiomes(area.getWorldName(), region, biome);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Check if a given world name corresponds to a real world
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user