diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlayerFunctions.java b/PlotSquared/src/com/intellectualcrafters/plot/PlayerFunctions.java index 97bec2db9..5bfe23be8 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlayerFunctions.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlayerFunctions.java @@ -78,10 +78,18 @@ public class PlayerFunctions { public static Plot getBottomPlot(World world, Plot plot) { if (plot.settings.getMerged(0)) { - return getBottomPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x, plot.id.y - 1))); + Plot p = PlotMain.getPlots(world).get(new PlotId(plot.id.x, plot.id.y - 1)); + if (p==null) { + return plot; + } + return getBottomPlot(world, p); } if (plot.settings.getMerged(3)) { - return getBottomPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x - 1, plot.id.y))); + Plot p = PlotMain.getPlots(world).get(new PlotId(plot.id.x - 1, plot.id.y)); + if (p==null) { + return plot; + } + return getBottomPlot(world, p); } return plot; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java index 4d730e4a3..bbae7c6dd 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java @@ -1136,8 +1136,9 @@ public class PlotMain extends JavaPlugin { if (!config.contains("worlds." + world)) { config.createSection("worlds." + world); } + + plotworld.saveConfiguration(config.getConfigurationSection("worlds." + world)); - plotworld.loadDefaultConfiguration(config.getConfigurationSection("worlds." + world)); try { diff --git a/PlotSquared/src/com/intellectualcrafters/plot/UUIDHandler.java b/PlotSquared/src/com/intellectualcrafters/plot/UUIDHandler.java index 01e319dcc..abb3c3521 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/UUIDHandler.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/UUIDHandler.java @@ -52,7 +52,9 @@ public class UUIDHandler { } public static void add(StringWrapper name, UUID uuid) { - uuidMap.put(name, uuid); + if (!uuidMap.containsKey(name) && !uuidMap.inverse().containsKey(uuid)) { + uuidMap.put(name, uuid); + } } /** diff --git a/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java b/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java index 0a9804df4..8e1e21ca7 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java @@ -6,6 +6,7 @@ import org.bukkit.configuration.ConfigurationSection; import com.intellectualcrafters.plot.Configuration; import com.intellectualcrafters.plot.ConfigurationNode; import com.intellectualcrafters.plot.PlotBlock; +import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotWorld; public class DefaultPlotWorld extends PlotWorld { @@ -160,6 +161,11 @@ public class DefaultPlotWorld extends PlotWorld { @Override public void loadConfiguration(ConfigurationSection config) { this.PLOT_HEIGHT = config.getInt("plot.height"); + + if (!config.contains("plot.height")) { + PlotMain.sendConsoleSenderMessage(" - &Configuration is null? ("+config.getCurrentPath()+")"); + } + this.PLOT_WIDTH = config.getInt("plot.size"); this.MAIN_BLOCK = (PlotBlock[]) Configuration.BLOCKLIST.parseString(StringUtils.join(config.getStringList("plot.filling"), ',')); diff --git a/PlotSquared/src/com/intellectualcrafters/plot/generator/WorldGenerator.java b/PlotSquared/src/com/intellectualcrafters/plot/generator/WorldGenerator.java index b7844da51..4ceb846f7 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/generator/WorldGenerator.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/generator/WorldGenerator.java @@ -7,11 +7,14 @@ import java.util.Random; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.block.Biome; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.generator.BlockPopulator; import com.intellectualcrafters.plot.ConfigurationNode; import com.intellectualcrafters.plot.PlotBlock; import com.intellectualcrafters.plot.PlotGenerator; +import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotManager; import com.intellectualcrafters.plot.PlotWorld; @@ -148,6 +151,19 @@ public class WorldGenerator extends PlotGenerator { public WorldGenerator(String world) { super(world); + if (this.plotworld == null) { + this.plotworld = new DefaultPlotWorld(world); + if (!PlotMain.config.contains("worlds."+world)) { + PlotMain.config = YamlConfiguration.loadConfiguration(PlotMain.configFile); + PlotMain.config.createSection("worlds."+world); + } + ConfigurationSection section = PlotMain.config.getConfigurationSection("worlds."+world); + this.plotworld.saveConfiguration(section); + this.plotworld.loadDefaultConfiguration(section); + this.plotworld.loadConfiguration(section); + PlotMain.sendConsoleSenderMessage("&cFailed to load the plotworld settings from the configuration. Attempting to reload it"); + } + this.plotsize = this.plotworld.PLOT_WIDTH; this.pathsize = this.plotworld.ROAD_WIDTH;