Add config option to disable placing top wall blocks

This commit is contained in:
dordsor21 2020-07-14 19:10:53 +01:00
parent 32264ae5e3
commit 2e4c43c251
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
3 changed files with 50 additions and 33 deletions

View File

@ -84,8 +84,8 @@ public class ClassicPlotManager extends SquarePlotManager {
@Override public boolean unClaimPlot(Plot plot, Runnable whenDone) { @Override public boolean unClaimPlot(Plot plot, Runnable whenDone) {
setWallFilling(plot.getId(), classicPlotWorld.WALL_FILLING.toPattern()); setWallFilling(plot.getId(), classicPlotWorld.WALL_FILLING.toPattern());
if (!classicPlotWorld.WALL_BLOCK.isAir() || !classicPlotWorld.WALL_BLOCK if (classicPlotWorld.PLACE_TOP_BLOCK && (!classicPlotWorld.WALL_BLOCK.isAir()
.equals(classicPlotWorld.CLAIMED_WALL_BLOCK)) { || !classicPlotWorld.WALL_BLOCK.equals(classicPlotWorld.CLAIMED_WALL_BLOCK))) {
setWall(plot.getId(), classicPlotWorld.WALL_BLOCK.toPattern()); setWall(plot.getId(), classicPlotWorld.WALL_BLOCK.toPattern());
} }
return GlobalBlockQueue.IMP.addEmptyTask(whenDone); return GlobalBlockQueue.IMP.addEmptyTask(whenDone);
@ -324,19 +324,23 @@ public class ClassicPlotManager extends SquarePlotManager {
queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx, 1, sz + 1), queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx, 1, sz + 1),
new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1), new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
classicPlotWorld.WALL_FILLING.toPattern()); classicPlotWorld.WALL_FILLING.toPattern());
if (classicPlotWorld.PLACE_TOP_BLOCK) {
queue.setCuboid( queue.setCuboid(
new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1, new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1,
sz + 1), sz + 1),
new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1, new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1,
ez - 1), classicPlotWorld.WALL_BLOCK.toPattern()); ez - 1), classicPlotWorld.WALL_BLOCK.toPattern());
}
queue.setCuboid(new Location(classicPlotWorld.getWorldName(), ex, 1, sz + 1), queue.setCuboid(new Location(classicPlotWorld.getWorldName(), ex, 1, sz + 1),
new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT, ez - 1), new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT, ez - 1),
classicPlotWorld.WALL_FILLING.toPattern()); classicPlotWorld.WALL_FILLING.toPattern());
if (classicPlotWorld.PLACE_TOP_BLOCK) {
queue.setCuboid( queue.setCuboid(
new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1, new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1,
sz + 1), sz + 1),
new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1, new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1,
ez - 1), classicPlotWorld.WALL_BLOCK.toPattern()); ez - 1), classicPlotWorld.WALL_BLOCK.toPattern());
}
queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1), queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1),
new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT,
ez - 1), classicPlotWorld.ROAD_BLOCK.toPattern()); ez - 1), classicPlotWorld.ROAD_BLOCK.toPattern());
@ -362,19 +366,21 @@ public class ClassicPlotManager extends SquarePlotManager {
queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, sz), queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, sz),
new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT, sz), new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT, sz),
classicPlotWorld.WALL_FILLING.toPattern()); classicPlotWorld.WALL_FILLING.toPattern());
queue.setCuboid( if (classicPlotWorld.PLACE_TOP_BLOCK) {
new Location(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1, queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1,
sz), classicPlotWorld.WALL_HEIGHT + 1, sz),
new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT + 1, new Location(classicPlotWorld.getWorldName(), ex - 1,
sz), classicPlotWorld.WALL_BLOCK.toPattern()); classicPlotWorld.WALL_HEIGHT + 1, sz), classicPlotWorld.WALL_BLOCK.toPattern());
}
queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, ez), queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, ez),
new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT, ez), new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT, ez),
classicPlotWorld.WALL_FILLING.toPattern()); classicPlotWorld.WALL_FILLING.toPattern());
queue.setCuboid( if (classicPlotWorld.PLACE_TOP_BLOCK) {
new Location(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1, queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1,
ez), classicPlotWorld.WALL_HEIGHT + 1, ez),
new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT + 1, new Location(classicPlotWorld.getWorldName(), ex - 1,
ez), classicPlotWorld.WALL_BLOCK.toPattern()); classicPlotWorld.WALL_HEIGHT + 1, ez), classicPlotWorld.WALL_BLOCK.toPattern());
}
queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1), queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1),
new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT,
ez - 1), classicPlotWorld.ROAD_BLOCK.toPattern()); ez - 1), classicPlotWorld.ROAD_BLOCK.toPattern());
@ -477,7 +483,8 @@ public class ClassicPlotManager extends SquarePlotManager {
*/ */
@Override public boolean finishPlotMerge(List<PlotId> plotIds) { @Override public boolean finishPlotMerge(List<PlotId> plotIds) {
final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK;
if (!claim.isAir() || !claim.equals(classicPlotWorld.WALL_BLOCK)) { if (classicPlotWorld.PLACE_TOP_BLOCK && (!claim.isAir() || !claim
.equals(classicPlotWorld.WALL_BLOCK))) {
for (PlotId plotId : plotIds) { for (PlotId plotId : plotIds) {
setWall(plotId, claim.toPattern()); setWall(plotId, claim.toPattern());
} }
@ -493,7 +500,8 @@ public class ClassicPlotManager extends SquarePlotManager {
@Override public boolean finishPlotUnlink(List<PlotId> plotIds) { @Override public boolean finishPlotUnlink(List<PlotId> plotIds) {
final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK;
if (!claim.isAir() || !claim.equals(classicPlotWorld.WALL_BLOCK)) { if (classicPlotWorld.PLACE_TOP_BLOCK && (!claim.isAir() || !claim
.equals(classicPlotWorld.WALL_BLOCK))) {
for (PlotId id : plotIds) { for (PlotId id : plotIds) {
setWall(id, claim.toPattern()); setWall(id, claim.toPattern());
} }
@ -511,7 +519,8 @@ public class ClassicPlotManager extends SquarePlotManager {
@Override public boolean claimPlot(Plot plot) { @Override public boolean claimPlot(Plot plot) {
final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK;
if (!claim.isAir() || !claim.equals(classicPlotWorld.WALL_BLOCK)) { if (classicPlotWorld.PLACE_TOP_BLOCK && (!claim.isAir() || !claim
.equals(classicPlotWorld.WALL_BLOCK))) {
return setWall(plot.getId(), claim.toPattern()); return setWall(plot.getId(), claim.toPattern());
} }
return true; return true;

View File

@ -52,6 +52,7 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
public BlockBucket ROAD_BLOCK = new BlockBucket(BlockTypes.QUARTZ_BLOCK); public BlockBucket ROAD_BLOCK = new BlockBucket(BlockTypes.QUARTZ_BLOCK);
// BlockUtil.get((short) 155, (byte) 0); // BlockUtil.get((short) 155, (byte) 0);
public boolean PLOT_BEDROCK = true; public boolean PLOT_BEDROCK = true;
public boolean PLACE_TOP_BLOCK = true;
public ClassicPlotWorld(String worldName, String id, public ClassicPlotWorld(String worldName, String id,
@NotNull IndependentPlotGenerator generator, PlotId min, PlotId max) { @NotNull IndependentPlotGenerator generator, PlotId min, PlotId max) {
@ -79,6 +80,8 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
ConfigurationUtil.BLOCK_BUCKET), ConfigurationUtil.BLOCK_BUCKET),
new ConfigurationNode("wall.block_claimed", this.CLAIMED_WALL_BLOCK, new ConfigurationNode("wall.block_claimed", this.CLAIMED_WALL_BLOCK,
"Wall block (claimed)", ConfigurationUtil.BLOCK_BUCKET), "Wall block (claimed)", ConfigurationUtil.BLOCK_BUCKET),
new ConfigurationNode("wall.place_top_block", this.PLACE_TOP_BLOCK,
"Place or not the top block", ConfigurationUtil.BOOLEAN),
new ConfigurationNode("road.width", this.ROAD_WIDTH, "Road width", new ConfigurationNode("road.width", this.ROAD_WIDTH, "Road width",
ConfigurationUtil.INTEGER), ConfigurationUtil.INTEGER),
new ConfigurationNode("road.height", this.ROAD_HEIGHT, "Road height", new ConfigurationNode("road.height", this.ROAD_HEIGHT, "Road height",
@ -109,5 +112,6 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
this.WALL_FILLING = new BlockBucket(config.getString("wall.filling")); this.WALL_FILLING = new BlockBucket(config.getString("wall.filling"));
this.WALL_HEIGHT = Math.min(254, config.getInt("wall.height")); this.WALL_HEIGHT = Math.min(254, config.getInt("wall.height"));
this.CLAIMED_WALL_BLOCK = new BlockBucket(config.getString("wall.block_claimed")); this.CLAIMED_WALL_BLOCK = new BlockBucket(config.getString("wall.block_claimed"));
this.PLACE_TOP_BLOCK = config.getBoolean("wall.place_top_block");
} }
} }

View File

@ -172,8 +172,10 @@ public class HybridGen extends IndependentPlotGenerator {
result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern()); result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern());
} }
if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
if (hybridPlotWorld.PLACE_TOP_BLOCK) {
result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z, result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z,
hybridPlotWorld.WALL_BLOCK.toPattern()); hybridPlotWorld.WALL_BLOCK.toPattern());
}
} else { } else {
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z,
true); true);
@ -197,8 +199,10 @@ public class HybridGen extends IndependentPlotGenerator {
result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern()); result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern());
} }
if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
if (hybridPlotWorld.PLACE_TOP_BLOCK) {
result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z, result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z,
hybridPlotWorld.WALL_BLOCK.toPattern()); hybridPlotWorld.WALL_BLOCK.toPattern());
}
} else { } else {
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z,
true); true);