From c3e271b22b0bcc42b2f309fac879f69865cf3477 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Tue, 23 Sep 2014 13:40:15 +1000 Subject: [PATCH] ADDED default flags in settings.yml --- .../com/intellectualcrafters/plot/PlotWorld.java | 9 ++++++++- .../intellectualcrafters/plot/WorldGenerator.java | 15 +++++++++++++-- .../plot/database/DBFunc.java | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java index 1f5e9d5a1..4b1f499d9 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java @@ -197,5 +197,12 @@ public class PlotWorld { * Default schematic file: 'null' */ public static String SCHEMATIC_FILE_DEFAULT = "null"; - + /** + * default flags + */ + public Flag[] DEFAULT_FLAGS; + /** + * Default default flags + */ + public static String[] DEFAULT_FLAGS_DEFAULT = new String[] {}; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java b/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java index 09ae923b3..e1bab94d2 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java @@ -84,9 +84,9 @@ public class WorldGenerator extends ChunkGenerator { // options.put("worlds."+world+".road_stripes", ROAD_STRIPES_DEFAULT); options.put("worlds."+world+".wall_filling", WALL_FILLING_DEFAULT); options.put("worlds."+world+".wall_height", WALL_HEIGHT_DEFAULT); - options.put("worlds."+world+".schematic_on_claim", SCHEMATIC_ON_CLAIM_DEFAULT); options.put("worlds."+world+".schematic_file", SCHEMATIC_FILE_DEFAULT); + options.put("worlds."+world+".default_flags", DEFAULT_FLAGS_DEFAULT); for (Entry node : options.entrySet()) { if (!config.contains(node.getKey())) { @@ -111,9 +111,20 @@ public class WorldGenerator extends ChunkGenerator { plotworld.WALL_FILLING = config.getString("worlds."+world+".wall_filling"); plotworld.WALL_HEIGHT = config.getInt("worlds."+world+".wall_height"); plotworld.PLOT_CHAT = config.getBoolean("worlds."+world+".plot_chat"); - plotworld.SCHEMATIC_ON_CLAIM = config.getBoolean("worlds."+world+".schematic_on_claim"); plotworld.SCHEMATIC_FILE = config.getString("worlds."+world+".schematic_file"); + + String[] default_flags_string = config.getStringList("worlds."+world+".default_flags").toArray(new String[0]); + Flag[] default_flags = new Flag[default_flags_string.length]; + for (int i = 0; i < default_flags.length; i++) { + String current = default_flags_string[i]; + if (current.contains(",")) + default_flags[i] = new Flag(current.split(",")[0], current.split(",")[1]); + else + default_flags[i] = new Flag(current, ""); + } + plotworld.DEFAULT_FLAGS = default_flags; + PlotMain.addPlotWorld(world, plotworld); plotsize = plotworld.PLOT_WIDTH; diff --git a/PlotSquared/src/com/intellectualcrafters/plot/database/DBFunc.java b/PlotSquared/src/com/intellectualcrafters/plot/database/DBFunc.java index 5301d90f3..3cd9e352b 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/database/DBFunc.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/database/DBFunc.java @@ -328,7 +328,7 @@ public class DBFunc { stmt.close(); } catch(SQLException e) { e.printStackTrace(); - Logger.add(LogLevel.WARNING, "Could not set weather for plot " + plot.id); + Logger.add(LogLevel.WARNING, "Could not set flag for plot " + plot.id); } } });