Add option for legacy sign material

Follow up to cde27899dd
This commit is contained in:
NotMyFault 2021-05-22 12:34:04 +02:00
parent eb7eb15ee7
commit 87706d471b
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
2 changed files with 30 additions and 4 deletions

View File

@ -341,7 +341,6 @@ public class BukkitUtil extends WorldUtil {
PlotArea area = location.getPlotArea(); PlotArea area = location.getPlotArea();
final World world = getWorld(location.getWorldName()); final World world = getWorld(location.getWorldName());
final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ()); final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ());
// block.setType(Material.AIR);
final Material type = block.getType(); final Material type = block.getType();
if (type != Material.LEGACY_SIGN && type != Material.LEGACY_WALL_SIGN) { if (type != Material.LEGACY_SIGN && type != Material.LEGACY_WALL_SIGN) {
BlockFace facing = BlockFace.EAST; BlockFace facing = BlockFace.EAST;
@ -353,7 +352,7 @@ public class BukkitUtil extends WorldUtil {
facing = BlockFace.SOUTH; facing = BlockFace.SOUTH;
} }
if (PlotSquared.platform().serverVersion()[1] == 13) { if (PlotSquared.platform().serverVersion()[1] == 13) {
block.setType(Material.valueOf("WALL_SIGN"), false); block.setType(Material.valueOf(area.legacySignMaterial()), false);
} else { } else {
block.setType(Material.valueOf(area.signMaterial()), false); block.setType(Material.valueOf(area.signMaterial()), false);
} }

View File

@ -155,6 +155,7 @@ public abstract class PlotArea {
private ConcurrentHashMap<String, Object> meta; private ConcurrentHashMap<String, Object> meta;
private QuadMap<PlotCluster> clusters; private QuadMap<PlotCluster> clusters;
private String signMaterial = "OAK_WALL_SIGN"; private String signMaterial = "OAK_WALL_SIGN";
private String legacySignMaterial = "WALL_SIGN";
public PlotArea( public PlotArea(
final @NonNull String worldName, final @Nullable String id, final @NonNull String worldName, final @Nullable String id,
@ -325,7 +326,11 @@ public abstract class PlotArea {
this.mobSpawnerSpawning = config.getBoolean("mob_spawner_spawning"); this.mobSpawnerSpawning = config.getBoolean("mob_spawner_spawning");
this.autoMerge = config.getBoolean("plot.auto_merge"); this.autoMerge = config.getBoolean("plot.auto_merge");
this.allowSigns = config.getBoolean("plot.create_signs"); this.allowSigns = config.getBoolean("plot.create_signs");
if (PlotSquared.platform().serverVersion()[1] == 13) {
this.legacySignMaterial = config.getString("plot.legacy_sign_material");
} else {
this.signMaterial = config.getString("plot.sign_material"); this.signMaterial = config.getString("plot.sign_material");
}
String biomeString = config.getString("plot.biome"); String biomeString = config.getString("plot.biome");
if (!biomeString.startsWith("minecraft:")) { if (!biomeString.startsWith("minecraft:")) {
biomeString = "minecraft:" + biomeString; biomeString = "minecraft:" + biomeString;
@ -486,7 +491,11 @@ public abstract class PlotArea {
options.put("mob_spawner_spawning", this.isMobSpawnerSpawning()); options.put("mob_spawner_spawning", this.isMobSpawnerSpawning());
options.put("plot.auto_merge", this.isAutoMerge()); options.put("plot.auto_merge", this.isAutoMerge());
options.put("plot.create_signs", this.allowSigns()); options.put("plot.create_signs", this.allowSigns());
if (PlotSquared.platform().serverVersion()[1] == 13) {
options.put("plot.legacy_sign_material", this.legacySignMaterial);
} else {
options.put("plot.sign_material", this.signMaterial()); options.put("plot.sign_material", this.signMaterial());
}
options.put("plot.biome", "minecraft:forest"); options.put("plot.biome", "minecraft:forest");
options.put("schematic.on_claim", this.isSchematicOnClaim()); options.put("schematic.on_claim", this.isSchematicOnClaim());
options.put("schematic.file", this.getSchematicFile()); options.put("schematic.file", this.getSchematicFile());
@ -1172,6 +1181,19 @@ public abstract class PlotArea {
return signMaterial; return signMaterial;
} }
/**
* Get the legacy plot sign material before wall signs used a "wall" stance.
*
* @return the legacy sign material.
* @deprecated Use {@link #signMaterial()}. This method is used for 1.13 only and
* will be removed without replacement in favor of {@link #signMaterial()}
* once we remove the support for 1.13.
*/
@Deprecated
public String legacySignMaterial() {
return legacySignMaterial;
}
/** /**
* Get the value associated with the specified flag. This will look at * Get the value associated with the specified flag. This will look at
* the default values stored in {@link GlobalFlagContainer}. * the default values stored in {@link GlobalFlagContainer}.
@ -1294,6 +1316,11 @@ public abstract class PlotArea {
return this.signMaterial; return this.signMaterial;
} }
@Deprecated
public String getLegacySignMaterial() {
return this.legacySignMaterial;
}
public boolean isSpawnCustom() { public boolean isSpawnCustom() {
return this.spawnCustom; return this.spawnCustom;
} }