bug fixes???

Josh was having trouble loading the worlds, so calling the load method
twice somehow fixed it??
This commit is contained in:
boy0001 2014-10-26 23:17:03 +11:00
parent 5c51a46271
commit e3e18b259d
5 changed files with 37 additions and 4 deletions

View File

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

View File

@ -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.saveConfiguration(config.getConfigurationSection("worlds." + world));
plotworld.loadDefaultConfiguration(config.getConfigurationSection("worlds." + world));
try {

View File

@ -52,8 +52,10 @@ public class UUIDHandler {
}
public static void add(StringWrapper name, UUID uuid) {
if (!uuidMap.containsKey(name) && !uuidMap.inverse().containsKey(uuid)) {
uuidMap.put(name, uuid);
}
}
/**
* @param name

View File

@ -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"), ','));

View File

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