Don't allow players to modify outside build height when using plot set / schematics.

- Also fixes schematic height issues
This commit is contained in:
dordsor21 2022-02-15 15:36:13 +00:00 committed by Jordan
parent dc6d0e089f
commit 7343319fe6
4 changed files with 14 additions and 14 deletions

View File

@ -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(plot.getArea().getMinGenHeight());
corners[1] = corners[1].withY(plot.getArea().getMaxGenHeight());
corners[0] = corners[0].withY(plot.getArea().getMinBuildHeight());
corners[1] = corners[1].withY(plot.getArea().getMaxBuildHeight());
int size = (corners[1].getX() - corners[0].getX()) + 1;
PlotId id = plot.getId();
String world1 = plot.getArea().toString().replaceAll(";", "-")

View File

@ -150,8 +150,8 @@ public class ClassicPlotManager extends SquarePlotManager {
classicPlotWorld,
plot.getRegions(),
blocks,
classicPlotWorld.getMinGenHeight() + (classicPlotWorld.PLOT_BEDROCK ? 1 : 0),
classicPlotWorld.getMaxGenHeight(),
classicPlotWorld.getMinBuildHeight(),
classicPlotWorld.getMaxBuildHeight(),
actor,
queue
);
@ -182,7 +182,7 @@ public class ClassicPlotManager extends SquarePlotManager {
plot.getRegions(),
blocks,
classicPlotWorld.PLOT_HEIGHT + 1,
classicPlotWorld.getMaxGenHeight(),
classicPlotWorld.getMaxBuildHeight(),
actor,
queue
);
@ -211,7 +211,7 @@ public class ClassicPlotManager extends SquarePlotManager {
classicPlotWorld,
plot.getRegions(),
blocks,
classicPlotWorld.getMinGenHeight() + (classicPlotWorld.PLOT_BEDROCK ? 1 : 0),
classicPlotWorld.getMinBuildHeight(),
classicPlotWorld.PLOT_HEIGHT - 1,
actor,
queue
@ -288,7 +288,7 @@ public class ClassicPlotManager extends SquarePlotManager {
}
}
int maxY = classicPlotWorld.getMaxGenHeight();
int maxY = classicPlotWorld.getMaxBuildHeight();
if (!plot.isMerged(Direction.NORTH)) {
int z = bottom.getZ();
for (int x = bottom.getX(); x <= top.getX(); x++) {
@ -386,11 +386,10 @@ public class ClassicPlotManager extends SquarePlotManager {
}
}
int startYOffset = classicPlotWorld.PLOT_BEDROCK ? 1 : 0;
if (!plot.isMerged(Direction.NORTH)) {
int z = bot.getZ();
for (int x = bot.getX(); x < top.getX(); x++) {
for (int y = classicPlotWorld.getMinGenHeight() + startYOffset; y <= classicPlotWorld.WALL_HEIGHT; y++) {
for (int y = classicPlotWorld.getMaxBuildHeight(); y <= classicPlotWorld.WALL_HEIGHT; y++) {
queue.setBlock(x, y, z, blocks);
}
}
@ -398,7 +397,7 @@ public class ClassicPlotManager extends SquarePlotManager {
if (!plot.isMerged(Direction.WEST)) {
int x = bot.getX();
for (int z = bot.getZ(); z < top.getZ(); z++) {
for (int y = classicPlotWorld.getMinGenHeight() + startYOffset; y <= classicPlotWorld.WALL_HEIGHT; y++) {
for (int y = classicPlotWorld.getMinBuildHeight(); y <= classicPlotWorld.WALL_HEIGHT; y++) {
queue.setBlock(x, y, z, blocks);
}
}
@ -406,7 +405,7 @@ public class ClassicPlotManager extends SquarePlotManager {
if (!plot.isMerged(Direction.SOUTH)) {
int z = top.getZ();
for (int x = bot.getX(); x < top.getX() + (plot.isMerged(Direction.EAST) ? 0 : 1); x++) {
for (int y = classicPlotWorld.getMinGenHeight() + startYOffset; y <= classicPlotWorld.WALL_HEIGHT; y++) {
for (int y = classicPlotWorld.getMinBuildHeight(); y <= classicPlotWorld.WALL_HEIGHT; y++) {
queue.setBlock(x, y, z, blocks);
}
}
@ -414,7 +413,7 @@ public class ClassicPlotManager extends SquarePlotManager {
if (!plot.isMerged(Direction.EAST)) {
int x = top.getX();
for (int z = bot.getZ(); z < top.getZ() + (plot.isMerged(Direction.SOUTH) ? 0 : 1); z++) {
for (int y = classicPlotWorld.getMinGenHeight() + startYOffset; y <= classicPlotWorld.WALL_HEIGHT; y++) {
for (int y = classicPlotWorld.getMinBuildHeight(); y <= classicPlotWorld.WALL_HEIGHT; y++) {
queue.setBlock(x, y, z, blocks);
}
}

View File

@ -2438,8 +2438,8 @@ public class Plot {
return regions_cache;
}
if (!this.isMerged()) {
Location pos1 = this.getBottomAbs();
Location pos2 = this.getTopAbs();
Location pos1 = this.getBottomAbs().withY(getArea().getMinBuildHeight());
Location pos2 = this.getTopAbs().withY(getArea().getMaxBuildHeight());
connected_cache = Sets.newHashSet(this);
CuboidRegion rg = new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3());
regions_cache = Collections.singleton(rg);

View File

@ -676,6 +676,7 @@ public abstract class SchematicHandler {
final int minX = minimum.getX();
final int minZ = minimum.getZ();
final int minY = minimum.getY();
System.out.println(minY);
final int maxX = maximum.getX();
final int maxZ = maximum.getZ();