Allow signs to be disabled.

This commit is contained in:
boy0001 2015-02-24 18:11:14 +11:00
parent 4d4cec4cb1
commit 2e041c8683
3 changed files with 10 additions and 4 deletions

View File

@ -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);

View File

@ -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<String, Object> 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);

View File

@ -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) {