mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Add config option to disable placing top wall blocks
This commit is contained in:
parent
32264ae5e3
commit
2e4c43c251
3 changed files with 50 additions and 33 deletions
|
@ -84,8 +84,8 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||
|
||||
@Override public boolean unClaimPlot(Plot plot, Runnable whenDone) {
|
||||
setWallFilling(plot.getId(), classicPlotWorld.WALL_FILLING.toPattern());
|
||||
if (!classicPlotWorld.WALL_BLOCK.isAir() || !classicPlotWorld.WALL_BLOCK
|
||||
.equals(classicPlotWorld.CLAIMED_WALL_BLOCK)) {
|
||||
if (classicPlotWorld.PLACE_TOP_BLOCK && (!classicPlotWorld.WALL_BLOCK.isAir()
|
||||
|| !classicPlotWorld.WALL_BLOCK.equals(classicPlotWorld.CLAIMED_WALL_BLOCK))) {
|
||||
setWall(plot.getId(), classicPlotWorld.WALL_BLOCK.toPattern());
|
||||
}
|
||||
return GlobalBlockQueue.IMP.addEmptyTask(whenDone);
|
||||
|
@ -324,19 +324,23 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||
queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx, 1, sz + 1),
|
||||
new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
|
||||
classicPlotWorld.WALL_FILLING.toPattern());
|
||||
if (classicPlotWorld.PLACE_TOP_BLOCK) {
|
||||
queue.setCuboid(
|
||||
new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1,
|
||||
sz + 1),
|
||||
new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1,
|
||||
ez - 1), classicPlotWorld.WALL_BLOCK.toPattern());
|
||||
}
|
||||
queue.setCuboid(new Location(classicPlotWorld.getWorldName(), ex, 1, sz + 1),
|
||||
new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT, ez - 1),
|
||||
classicPlotWorld.WALL_FILLING.toPattern());
|
||||
if (classicPlotWorld.PLACE_TOP_BLOCK) {
|
||||
queue.setCuboid(
|
||||
new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1,
|
||||
sz + 1),
|
||||
new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1,
|
||||
ez - 1), classicPlotWorld.WALL_BLOCK.toPattern());
|
||||
}
|
||||
queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1),
|
||||
new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT,
|
||||
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),
|
||||
new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT, sz),
|
||||
classicPlotWorld.WALL_FILLING.toPattern());
|
||||
queue.setCuboid(
|
||||
new Location(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1,
|
||||
sz),
|
||||
new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT + 1,
|
||||
sz), classicPlotWorld.WALL_BLOCK.toPattern());
|
||||
if (classicPlotWorld.PLACE_TOP_BLOCK) {
|
||||
queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1,
|
||||
classicPlotWorld.WALL_HEIGHT + 1, sz),
|
||||
new Location(classicPlotWorld.getWorldName(), ex - 1,
|
||||
classicPlotWorld.WALL_HEIGHT + 1, sz), classicPlotWorld.WALL_BLOCK.toPattern());
|
||||
}
|
||||
queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, ez),
|
||||
new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT, ez),
|
||||
classicPlotWorld.WALL_FILLING.toPattern());
|
||||
queue.setCuboid(
|
||||
new Location(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1,
|
||||
ez),
|
||||
new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT + 1,
|
||||
ez), classicPlotWorld.WALL_BLOCK.toPattern());
|
||||
if (classicPlotWorld.PLACE_TOP_BLOCK) {
|
||||
queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1,
|
||||
classicPlotWorld.WALL_HEIGHT + 1, ez),
|
||||
new Location(classicPlotWorld.getWorldName(), ex - 1,
|
||||
classicPlotWorld.WALL_HEIGHT + 1, ez), classicPlotWorld.WALL_BLOCK.toPattern());
|
||||
}
|
||||
queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1),
|
||||
new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT,
|
||||
ez - 1), classicPlotWorld.ROAD_BLOCK.toPattern());
|
||||
|
@ -477,7 +483,8 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||
*/
|
||||
@Override public boolean finishPlotMerge(List<PlotId> plotIds) {
|
||||
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) {
|
||||
setWall(plotId, claim.toPattern());
|
||||
}
|
||||
|
@ -493,7 +500,8 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||
|
||||
@Override public boolean finishPlotUnlink(List<PlotId> plotIds) {
|
||||
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) {
|
||||
setWall(id, claim.toPattern());
|
||||
}
|
||||
|
@ -511,7 +519,8 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||
|
||||
@Override public boolean claimPlot(Plot plot) {
|
||||
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 true;
|
||||
|
|
|
@ -52,6 +52,7 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
|
|||
public BlockBucket ROAD_BLOCK = new BlockBucket(BlockTypes.QUARTZ_BLOCK);
|
||||
// BlockUtil.get((short) 155, (byte) 0);
|
||||
public boolean PLOT_BEDROCK = true;
|
||||
public boolean PLACE_TOP_BLOCK = true;
|
||||
|
||||
public ClassicPlotWorld(String worldName, String id,
|
||||
@NotNull IndependentPlotGenerator generator, PlotId min, PlotId max) {
|
||||
|
@ -79,6 +80,8 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
|
|||
ConfigurationUtil.BLOCK_BUCKET),
|
||||
new ConfigurationNode("wall.block_claimed", this.CLAIMED_WALL_BLOCK,
|
||||
"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",
|
||||
ConfigurationUtil.INTEGER),
|
||||
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_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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,8 +172,10 @@ public class HybridGen extends IndependentPlotGenerator {
|
|||
result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern());
|
||||
}
|
||||
if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
|
||||
if (hybridPlotWorld.PLACE_TOP_BLOCK) {
|
||||
result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z,
|
||||
hybridPlotWorld.WALL_BLOCK.toPattern());
|
||||
}
|
||||
} else {
|
||||
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z,
|
||||
true);
|
||||
|
@ -197,8 +199,10 @@ public class HybridGen extends IndependentPlotGenerator {
|
|||
result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern());
|
||||
}
|
||||
if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
|
||||
if (hybridPlotWorld.PLACE_TOP_BLOCK) {
|
||||
result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z,
|
||||
hybridPlotWorld.WALL_BLOCK.toPattern());
|
||||
}
|
||||
} else {
|
||||
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z,
|
||||
true);
|
||||
|
|
Loading…
Reference in a new issue