From 87706d471b450d0b5c698fdfb8eb3d8a0c4c78ff Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 22 May 2021 12:34:04 +0200 Subject: [PATCH] Add option for legacy sign material Follow up to cde27899dd019e40bb8b6008a456a9477ad246b7 --- .../plotsquared/bukkit/util/BukkitUtil.java | 3 +- .../com/plotsquared/core/plot/PlotArea.java | 31 +++++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java index b17e18983..2d6f5a650 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -341,7 +341,6 @@ public class BukkitUtil extends WorldUtil { PlotArea area = location.getPlotArea(); final World world = getWorld(location.getWorldName()); final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ()); - // block.setType(Material.AIR); final Material type = block.getType(); if (type != Material.LEGACY_SIGN && type != Material.LEGACY_WALL_SIGN) { BlockFace facing = BlockFace.EAST; @@ -353,7 +352,7 @@ public class BukkitUtil extends WorldUtil { facing = BlockFace.SOUTH; } if (PlotSquared.platform().serverVersion()[1] == 13) { - block.setType(Material.valueOf("WALL_SIGN"), false); + block.setType(Material.valueOf(area.legacySignMaterial()), false); } else { block.setType(Material.valueOf(area.signMaterial()), false); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java index 711e87dcf..844c857a0 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java @@ -155,6 +155,7 @@ public abstract class PlotArea { private ConcurrentHashMap meta; private QuadMap clusters; private String signMaterial = "OAK_WALL_SIGN"; + private String legacySignMaterial = "WALL_SIGN"; public PlotArea( final @NonNull String worldName, final @Nullable String id, @@ -325,7 +326,11 @@ public abstract class PlotArea { this.mobSpawnerSpawning = config.getBoolean("mob_spawner_spawning"); this.autoMerge = config.getBoolean("plot.auto_merge"); this.allowSigns = config.getBoolean("plot.create_signs"); - this.signMaterial = config.getString("plot.sign_material"); + if (PlotSquared.platform().serverVersion()[1] == 13) { + this.legacySignMaterial = config.getString("plot.legacy_sign_material"); + } else { + this.signMaterial = config.getString("plot.sign_material"); + } String biomeString = config.getString("plot.biome"); if (!biomeString.startsWith("minecraft:")) { biomeString = "minecraft:" + biomeString; @@ -486,7 +491,11 @@ public abstract class PlotArea { options.put("mob_spawner_spawning", this.isMobSpawnerSpawning()); options.put("plot.auto_merge", this.isAutoMerge()); options.put("plot.create_signs", this.allowSigns()); - options.put("plot.sign_material", this.signMaterial()); + 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.biome", "minecraft:forest"); options.put("schematic.on_claim", this.isSchematicOnClaim()); options.put("schematic.file", this.getSchematicFile()); @@ -1172,6 +1181,19 @@ public abstract class PlotArea { 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 * the default values stored in {@link GlobalFlagContainer}. @@ -1294,6 +1316,11 @@ public abstract class PlotArea { return this.signMaterial; } + @Deprecated + public String getLegacySignMaterial() { + return this.legacySignMaterial; + } + public boolean isSpawnCustom() { return this.spawnCustom; }