From 2335b0872805ee7449438df4fe85a4fab6f98b21 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Tue, 23 Sep 2014 12:26:25 +1000 Subject: [PATCH] Yes, I can implement that setting PlotWorld class: /* * - All existing PlotWorld instances should be kept in PlotMain (worlds variable) * - The accessors and mutators are: * PlotMain.isPlotWorld(world) * PlotMain.getPlotWorlds() or PlotMain.getPlotWorldsString() <- use this if you don't need to get world objects * PlotMain.getWorldSettings(World) - get the PlotWorld class for a world * * Also added is getWorldPlots(World) as the plots are now sorted per world * * To get the world of a plot, you can use plot.world - (string) or plot.getWorld() - (world object) * * All PlotWorld settings are per world in the settings.yml (these settings are automatically added when a world is loaded, either at startup or if a new world is created): * - You can find this in the WorldGenerator class (yeah, it's possibly not the best place, but it makes sure worlds are added to the settings.yml) * * All new DEFAULT CONSTANTS should be static and be given a value * All new variables should not be static and should not be given any values here, but rather in the WorldGenerator class * */ --- .../intellectualcrafters/plot/PlotWorld.java | 40 +++++++++++++++++-- .../plot/WorldGenerator.java | 6 +++ 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java index 5a5ae8bdd..1f5e9d5a1 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java @@ -5,6 +5,27 @@ import org.bukkit.Material; import java.util.ArrayList; public class PlotWorld { + + /* + * This is the PlotWorld class (obviously) + * - All existing PlotWorld instances should be kept in PlotMain (worlds variable) + * - The accessors and mutators are: + * PlotMain.isPlotWorld(world) + * PlotMain.getPlotWorlds() or PlotMain.getPlotWorldsString() <- use this if you don't need to get world objects + * PlotMain.getWorldSettings(World) - get the PlotWorld class for a world + * + * Also added is getWorldPlots(World) as the plots are now sorted per world + * + * To get the world of a plot, you can use plot.world - (string) or plot.getWorld() (world object) + * + * All PlotWorld settings are per world in the settings.yml (these settings are automatically added when a world is loaded, either at startup or if a new world is created): + * - You can find this in the WorldGenerator class (yeah, it's possibly not the best place, but it makes sure worlds are added to the settings.yml) + * + * All new DEFAULT CONSTANTS should be static and be given a value + * All new variables should not be static and should not be given any values here, but rather in the WorldGenerator class + * + */ + /** * Road Height */ @@ -160,8 +181,21 @@ public class PlotWorld { */ public static ArrayList BLOCKS = new ArrayList(); - - public boolean SCHEMATIC_ON_CLAIM = false; - public String SCHEMATIC_FILE = "null"; + /** + * schematic on claim + */ + public boolean SCHEMATIC_ON_CLAIM; + /** + * Default schematic on claim: false + */ + public static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false; + /** + * schematic file + */ + public String SCHEMATIC_FILE; + /** + * Default schematic file: 'null' + */ + public static String SCHEMATIC_FILE_DEFAULT = "null"; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java b/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java index 1833a6b5b..2ff4140b7 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java @@ -85,6 +85,9 @@ public class WorldGenerator extends ChunkGenerator { 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); + for (Entry node : options.entrySet()) { if (!config.contains(node.getKey())) { config.set(node.getKey(), node.getValue()); @@ -108,6 +111,9 @@ 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"); PlotMain.addPlotWorld(world, plotworld); plotsize = plotworld.PLOT_WIDTH;