From 2e041c8683ae1c23976b65b220b7d1c6c80156ba Mon Sep 17 00:00:00 2001 From: boy0001 Date: Tue, 24 Feb 2015 18:11:14 +1100 Subject: [PATCH] Allow signs to be disabled. --- .../plot/generator/ClassicPlotManager.java | 2 +- .../com/intellectualcrafters/plot/object/PlotWorld.java | 4 ++++ .../java/com/intellectualcrafters/plot/util/MainUtil.java | 8 +++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java index f3179fff8..6a0050de8 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java @@ -318,7 +318,7 @@ public abstract class ClassicPlotManager extends SquarePlotManager { * Remove sign for a plot */ @Override - public com.intellectualcrafters.plot.object.Location getSignLoc(final PlotWorld plotworld, final Plot plot) { + public Location getSignLoc(final PlotWorld plotworld, final Plot plot) { final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld; final Location bot = MainUtil.getPlotBottomLoc(plotworld.worldname, plot.id); return new com.intellectualcrafters.plot.object.Location(plotworld.worldname, bot.getX(), dpw.ROAD_HEIGHT + 1, bot.getZ() - 1); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java index 20c3d9121..8b29c521b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java @@ -38,6 +38,7 @@ import com.intellectualcrafters.plot.flag.FlagManager; */ public abstract class PlotWorld { public final static boolean AUTO_MERGE_DEFAULT = false; + public final static boolean ALLOW_SIGNS_DEFAULT = true; public final static boolean MOB_SPAWNING_DEFAULT = false; public final static String PLOT_BIOME_DEFAULT = "FOREST"; public final static boolean PLOT_CHAT_DEFAULT = false; @@ -65,6 +66,7 @@ public abstract class PlotWorld { } public final String worldname; public boolean AUTO_MERGE; + public boolean ALLOW_SIGNS; public boolean MOB_SPAWNING; public String PLOT_BIOME; public boolean PLOT_CHAT; @@ -102,6 +104,7 @@ public abstract class PlotWorld { } this.MOB_SPAWNING = config.getBoolean("natural_mob_spawning"); this.AUTO_MERGE = config.getBoolean("plot.auto_merge"); + this.ALLOW_SIGNS = config.getBoolean("plot.create_signs"); this.PLOT_BIOME = (String) Configuration.BIOME.parseString(config.getString("plot.biome")); this.SCHEMATIC_ON_CLAIM = config.getBoolean("schematic.on_claim"); this.SCHEMATIC_FILE = config.getString("schematic.file"); @@ -143,6 +146,7 @@ public abstract class PlotWorld { final HashMap options = new HashMap<>(); options.put("natural_mob_spawning", PlotWorld.MOB_SPAWNING_DEFAULT); options.put("plot.auto_merge", PlotWorld.AUTO_MERGE_DEFAULT); + options.put("plot.create_signs", PlotWorld.ALLOW_SIGNS_DEFAULT); options.put("plot.biome", PlotWorld.PLOT_BIOME_DEFAULT.toString()); options.put("schematic.on_claim", PlotWorld.SCHEMATIC_ON_CLAIM_DEFAULT); options.put("schematic.file", PlotWorld.SCHEMATIC_FILE_DEFAULT); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 577265e79..c40b8fd83 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -328,10 +328,12 @@ public class MainUtil { } final PlotManager manager = PlotSquared.getPlotManager(p.world); final PlotWorld plotworld = PlotSquared.getPlotWorld(p.world); + if (plotworld.ALLOW_SIGNS) { final Location loc = manager.getSignLoc(plotworld, p); - final String id = p.id.x + ";" + p.id.y; - final String[] lines = new String[] { C.OWNER_SIGN_LINE_1.translated().replaceAll("%id%", id), C.OWNER_SIGN_LINE_2.translated().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_3.translated().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_4.translated().replaceAll("%id%", id).replaceAll("%plr%", name) }; - BlockManager.setSign(p.world, loc.getX(), loc.getY(), loc.getZ(), lines); + final String id = p.id.x + ";" + p.id.y; + final String[] lines = new String[] { C.OWNER_SIGN_LINE_1.translated().replaceAll("%id%", id), C.OWNER_SIGN_LINE_2.translated().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_3.translated().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_4.translated().replaceAll("%id%", id).replaceAll("%plr%", name) }; + BlockManager.setSign(p.world, loc.getX(), loc.getY(), loc.getZ(), lines); + } } public static String getStringSized(final int max, final String string) {