From cde27899dd019e40bb8b6008a456a9477ad246b7 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 21 May 2021 19:14:13 +0200 Subject: [PATCH] Fixes #3064 --- .../plotsquared/bukkit/util/BukkitUtil.java | 33 +++++++------------ .../com/plotsquared/core/plot/PlotArea.java | 16 +++++++++ 2 files changed, 27 insertions(+), 22 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 0efe0a914..53cfc6b47 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -30,10 +30,12 @@ import com.plotsquared.bukkit.BukkitPlatform; import com.plotsquared.bukkit.player.BukkitPlayer; import com.plotsquared.bukkit.player.BukkitPlayerManager; import com.plotsquared.core.PlotSquared; +import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.caption.Caption; import com.plotsquared.core.configuration.caption.LocaleHolder; import com.plotsquared.core.location.Location; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.util.BlockUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.PlayerManager; @@ -337,6 +339,7 @@ public class BukkitUtil extends WorldUtil { final @NonNull Template... replacements ) { ensureLoaded(location.getWorldName(), location.getX(), location.getZ(), chunk -> { + 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); @@ -353,7 +356,7 @@ public class BukkitUtil extends WorldUtil { if (PlotSquared.platform().serverVersion()[1] == 13) { block.setType(Material.valueOf("WALL_SIGN"), false); } else { - block.setType(Material.valueOf("OAK_WALL_SIGN"), false); + block.setType(Material.valueOf(area.signMaterial()), false); } if (!(block.getBlockData() instanceof WallSign)) { throw new RuntimeException("Something went wrong generating a sign"); @@ -459,12 +462,8 @@ public class BukkitUtil extends WorldUtil { allowedInterfaces.add(WaterMob.class); allowedInterfaces.add(Ambient.class); } - case "tameable" -> { - allowedInterfaces.add(Tameable.class); - } - case "vehicle" -> { - allowedInterfaces.add(Vehicle.class); - } + case "tameable" -> allowedInterfaces.add(Tameable.class); + case "vehicle" -> allowedInterfaces.add(Vehicle.class); case "hostile" -> { allowedInterfaces.add(Shulker.class); allowedInterfaces.add(Monster.class); @@ -474,15 +473,9 @@ public class BukkitUtil extends WorldUtil { allowedInterfaces.add(Phantom.class); allowedInterfaces.add(EnderCrystal.class); } - case "hanging" -> { - allowedInterfaces.add(Hanging.class); - } - case "villager" -> { - allowedInterfaces.add(NPC.class); - } - case "projectile" -> { - allowedInterfaces.add(Projectile.class); - } + case "hanging" -> allowedInterfaces.add(Hanging.class); + case "villager" -> allowedInterfaces.add(NPC.class); + case "projectile" -> allowedInterfaces.add(Projectile.class); case "other" -> { allowedInterfaces.add(ArmorStand.class); allowedInterfaces.add(FallingBlock.class); @@ -495,12 +488,8 @@ public class BukkitUtil extends WorldUtil { allowedInterfaces.add(EnderSignal.class); allowedInterfaces.add(Firework.class); } - case "player" -> { - allowedInterfaces.add(Player.class); - } - default -> { - logger.error("Unknown entity category requested: {}", category); - } + case "player" -> allowedInterfaces.add(Player.class); + default -> logger.error("Unknown entity category requested: {}", category); } final Set types = new HashSet<>(); outer: 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 47f00de52..711e87dcf 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java @@ -154,6 +154,7 @@ public abstract class PlotArea { private CuboidRegion region; private ConcurrentHashMap meta; private QuadMap clusters; + private String signMaterial = "OAK_WALL_SIGN"; public PlotArea( final @NonNull String worldName, final @Nullable String id, @@ -324,6 +325,7 @@ 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"); String biomeString = config.getString("plot.biome"); if (!biomeString.startsWith("minecraft:")) { biomeString = "minecraft:" + biomeString; @@ -484,6 +486,7 @@ 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()); options.put("plot.biome", "minecraft:forest"); options.put("schematic.on_claim", this.isSchematicOnClaim()); options.put("schematic.file", this.getSchematicFile()); @@ -1160,6 +1163,15 @@ public abstract class PlotArea { return allowSigns; } + /** + * Get the plot sign material. + * + * @return the sign material. + */ + public String signMaterial() { + return signMaterial; + } + /** * Get the value associated with the specified flag. This will look at * the default values stored in {@link GlobalFlagContainer}. @@ -1278,6 +1290,10 @@ public abstract class PlotArea { return this.spawnEggs; } + public String getSignMaterial() { + return this.signMaterial; + } + public boolean isSpawnCustom() { return this.spawnCustom; }