mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Fix plot walls after running regenallroads
Also clears whatever was above the plot wall, such as pieces of the road.
This commit is contained in:
parent
a94c588a17
commit
7f404e1cf5
@ -250,17 +250,28 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
Location top = plot.getExtendedTopAbs().add(1, 0, 1);
|
||||
LocalBlockQueue queue = classicPlotWorld.getQueue(false);
|
||||
int y = classicPlotWorld.WALL_HEIGHT + 1;
|
||||
StringPlotBlock air = PlotBlock.get("air");
|
||||
if (!plot.getMerged(Direction.NORTH)) {
|
||||
int z = bot.getZ();
|
||||
for (int x = bot.getX(); x < top.getX(); x++) {
|
||||
queue.setBlock(x, y, z, blocks.getBlock());
|
||||
}
|
||||
// Replace all blocks above the wall with air
|
||||
queue.setCuboid(
|
||||
new Location(top.getWorld(), top.getX(), y + 1, bot.getZ()),
|
||||
new Location(bot.getWorld(), bot.getX(), 255, bot.getZ()),
|
||||
air);
|
||||
}
|
||||
if (!plot.getMerged(Direction.WEST)) {
|
||||
int x = bot.getX();
|
||||
for (int z = bot.getZ(); z < top.getZ(); z++) {
|
||||
queue.setBlock(x, y, z, blocks.getBlock());
|
||||
}
|
||||
// Replace all blocks above the wall with air
|
||||
queue.setCuboid(
|
||||
new Location(top.getWorld(), bot.getX(), y + 1, top.getZ()),
|
||||
new Location(bot.getWorld(), bot.getX(), 255, bot.getZ()),
|
||||
air);
|
||||
}
|
||||
if (!plot.getMerged(Direction.SOUTH)) {
|
||||
int z = top.getZ();
|
||||
@ -268,6 +279,11 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
x < top.getX() + (plot.getMerged(Direction.EAST) ? 0 : 1); x++) {
|
||||
queue.setBlock(x, y, z, blocks.getBlock());
|
||||
}
|
||||
// Replace all blocks above the wall with air
|
||||
queue.setCuboid(
|
||||
new Location(top.getWorld(), top.getX(), y + 1, top.getZ()),
|
||||
new Location(bot.getWorld(), bot.getX(), 255, top.getZ()),
|
||||
air);
|
||||
}
|
||||
if (!plot.getMerged(Direction.EAST)) {
|
||||
int x = top.getX();
|
||||
@ -275,6 +291,11 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
z < top.getZ() + (plot.getMerged(Direction.SOUTH) ? 0 : 1); z++) {
|
||||
queue.setBlock(x, y, z, blocks.getBlock());
|
||||
}
|
||||
// Replace all blocks above the wall with air
|
||||
queue.setCuboid(
|
||||
new Location(top.getWorld(), top.getX(), y + 1, top.getZ()),
|
||||
new Location(bot.getWorld(), top.getX(), 255, bot.getZ()),
|
||||
air);
|
||||
}
|
||||
queue.enqueue();
|
||||
return true;
|
||||
@ -439,6 +460,17 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean regenerateAllPlotWalls() {
|
||||
for (Plot plot : classicPlotWorld.getPlots()) {
|
||||
if (plot.hasOwner()) {
|
||||
setWall(plot.getId(), classicPlotWorld.CLAIMED_WALL_BLOCK);
|
||||
} else {
|
||||
setWall(plot.getId(), classicPlotWorld.WALL_BLOCK);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean startPlotMerge(List<PlotId> plotIds) {
|
||||
return true;
|
||||
}
|
||||
|
@ -153,6 +153,9 @@ public abstract class HybridUtils {
|
||||
PlotSquared.debug("PROGRESS: " + 100 * (2048 - chunks.size()) / 2048 + "%");
|
||||
}
|
||||
if (regions.isEmpty() && chunks.isEmpty()) {
|
||||
PlotSquared.debug("&3Regenerating plot walls");
|
||||
regeneratePlotWalls(area);
|
||||
|
||||
HybridUtils.UPDATE = false;
|
||||
PlotSquared.debug(Captions.PREFIX.s() + "Finished road conversion");
|
||||
// CANCEL TASK
|
||||
@ -377,4 +380,9 @@ public abstract class HybridUtils {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean regeneratePlotWalls(final PlotArea area) {
|
||||
PlotManager plotManager = area.getPlotManager();
|
||||
return plotManager.regenerateAllPlotWalls();
|
||||
}
|
||||
}
|
||||
|
@ -85,4 +85,6 @@ public abstract class PlotManager {
|
||||
return 255;
|
||||
}
|
||||
|
||||
public abstract boolean regenerateAllPlotWalls();
|
||||
|
||||
}
|
||||
|
@ -107,4 +107,6 @@ public class SinglePlotManager extends PlotManager {
|
||||
@Override public boolean finishPlotUnlink(List<PlotId> plotIds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public boolean regenerateAllPlotWalls() { return false; }
|
||||
}
|
||||
|
@ -97,9 +97,15 @@ public abstract class LocalBlockQueue {
|
||||
}
|
||||
|
||||
public void setCuboid(Location pos1, Location pos2, PlotBlock block) {
|
||||
for (int y = pos1.getY(); y <= Math.min(255, pos2.getY()); y++) {
|
||||
for (int x = pos1.getX(); x <= pos2.getX(); x++) {
|
||||
for (int z = pos1.getZ(); z <= pos2.getZ(); z++) {
|
||||
int yMin = Math.min(pos1.getY(), pos2.getY());
|
||||
int yMax = Math.min(255, 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());
|
||||
int zMax = Math.max(pos1.getZ(), pos2.getZ());
|
||||
for (int y = yMin; y <= yMax; y++) {
|
||||
for (int x = xMin; x <= xMax; x++) {
|
||||
for (int z = zMin; z <= zMax; z++) {
|
||||
setBlock(x, y, z, block);
|
||||
}
|
||||
}
|
||||
@ -107,9 +113,15 @@ public abstract class LocalBlockQueue {
|
||||
}
|
||||
|
||||
public void setCuboid(Location pos1, Location pos2, BlockBucket blocks) {
|
||||
for (int y = pos1.getY(); y <= Math.min(255, pos2.getY()); y++) {
|
||||
for (int x = pos1.getX(); x <= pos2.getX(); x++) {
|
||||
for (int z = pos1.getZ(); z <= pos2.getZ(); z++) {
|
||||
int yMin = Math.min(pos1.getY(), pos2.getY());
|
||||
int yMax = Math.min(255, 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());
|
||||
int zMax = Math.max(pos1.getZ(), pos2.getZ());
|
||||
for (int y = yMin; y <= yMax; y++) {
|
||||
for (int x = xMin; x <= xMax; x++) {
|
||||
for (int z = zMin; z <= zMax; z++) {
|
||||
setBlock(x, y, z, blocks.getBlock());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user