diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java index 3021f76db..a76bd8301 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java @@ -410,11 +410,12 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { @Override public boolean initPlotMeConverter() { - try { - new PlotMeConverter().runAsync(new ClassicPlotMeConnector()); - } catch (final Exception e) { - e.printStackTrace(); - } + TaskManager.runTaskLaterAsync(new Runnable() { + @Override + public void run() { + new PlotMeConverter().run(new ClassicPlotMeConnector()); + } + }, 20); if (Bukkit.getPluginManager().getPlugin("PlotMe") != null) { return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java index 8b0bba94d..b7a6bb37e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java @@ -570,7 +570,7 @@ public class PlotSquared { log("&cTHIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PLOTME!"); log("&c - Make sure 'UUID.read-from-disk' is disabled (false)!"); log("&c - Sometimes the database can be locked, deleting PlotMe.jar beforehand will fix the issue!"); - log("&c - After the conversion is finished, please set 'plotme-convert.enabled' to false in the 'settings.yml@'"); + log("&c - After the conversion is finished, please set 'plotme-convert.enabled' to false in the 'settings.yml'"); } } }, 200); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/ClassicPlotMeConnector.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/ClassicPlotMeConnector.java index ea2add089..768f3d839 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/ClassicPlotMeConnector.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/ClassicPlotMeConnector.java @@ -3,6 +3,7 @@ package com.intellectualcrafters.plot.database.plotme; import java.io.File; import java.sql.Connection; import java.sql.DriverManager; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; @@ -14,6 +15,7 @@ import org.bukkit.configuration.file.FileConfiguration; import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.database.DBFunc; +import com.intellectualcrafters.plot.database.MySQL; import com.intellectualcrafters.plot.database.SQLite; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; @@ -31,6 +33,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector { final String password = plotConfig.getString("mySQLpass"); final String con = plotConfig.getString("mySQLconn"); return DriverManager.getConnection(con, user, password); +// return new MySQL(plotsquared, hostname, port, database, username, password) } else { return new SQLite(PlotSquared.THIS, dataFolder + File.separator + "plots.db").openConnection(); } @@ -42,12 +45,11 @@ public class ClassicPlotMeConnector extends APlotMeConnector { @Override public HashMap> getPlotMePlots(Connection connection) throws SQLException { ResultSet r; - Statement stmt; + PreparedStatement stmt; final HashMap plotSize = new HashMap<>(); final HashMap> plots = new HashMap<>(); - stmt = connection.createStatement(); - r = stmt.executeQuery("SELECT * FROM `plotmePlots`"); - + stmt = connection.prepareStatement("SELECT * FROM `plotmePlots`"); + r = stmt.executeQuery(); boolean checkUUID = DBFunc.hasColumn(r, "ownerid"); while (r.next()) { @@ -91,48 +93,61 @@ public class ClassicPlotMeConnector extends APlotMeConnector { final Plot plot = new Plot(id, owner, new ArrayList(), new ArrayList(), world); plots.get(world).put(id, plot); } + r.close(); stmt.close(); - stmt = connection.createStatement(); - r = stmt.executeQuery("SELECT * FROM `plotmeAllowed`"); - while (r.next()) { - final PlotId id = new PlotId(r.getInt("idX"), r.getInt("idZ")); - final String name = r.getString("player"); - final String world = PlotMeConverter.getWorld(r.getString("world")); - UUID helper = UUIDHandler.getUUID(name); - if (helper == null) { - if (name.equals("*")) { - helper = DBFunc.everyone; - } else { - MainUtil.sendConsoleMessage("&6Could not identify helper for plot: " + id); - continue; + try { + + MainUtil.sendConsoleMessage(" - plotmeDenied"); + stmt = connection.prepareStatement("SELECT * FROM `plotmeDenied`"); + r = stmt.executeQuery(); + + while (r.next()) { + final PlotId id = new PlotId(r.getInt("idX"), r.getInt("idZ")); + final String name = r.getString("player"); + final String world = PlotMeConverter.getWorld(r.getString("world")); + UUID denied = UUIDHandler.getUUID(name); + if (denied == null) { + if (name.equals("*")) { + denied = DBFunc.everyone; + } else { + MainUtil.sendConsoleMessage("&6Could not identify denied for plot: " + id); + continue; + } + } + if (plots.get(world).containsKey(id)) { + plots.get(world).get(id).denied.add(denied); } } - if (plots.get(world).containsKey(id)) { - plots.get(world).get(id).helpers.add(helper); + + stmt = connection.prepareStatement("SELECT * FROM `plotmeAllowed`"); + r = stmt.executeQuery(); + + while (r.next()) { + final PlotId id = new PlotId(r.getInt("idX"), r.getInt("idZ")); + final String name = r.getString("player"); + final String world = PlotMeConverter.getWorld(r.getString("world")); + UUID helper = UUIDHandler.getUUID(name); + if (helper == null) { + if (name.equals("*")) { + helper = DBFunc.everyone; + } else { + MainUtil.sendConsoleMessage("&6Could not identify helper for plot: " + id); + continue; + } + } + if (plots.get(world).containsKey(id)) { + plots.get(world).get(id).helpers.add(helper); + } } + + r.close(); + stmt.close(); + } - - MainUtil.sendConsoleMessage(" - plotmeDenied"); - r = stmt.executeQuery("SELECT * FROM `plotmeDenied`"); - - while (r.next()) { - final PlotId id = new PlotId(r.getInt("idX"), r.getInt("idZ")); - final String name = r.getString("player"); - final String world = PlotMeConverter.getWorld(r.getString("world")); - UUID denied = UUIDHandler.getUUID(name); - if (denied == null) { - if (name.equals("*")) { - denied = DBFunc.everyone; - } else { - MainUtil.sendConsoleMessage("&6Could not identify denied for plot: " + id); - continue; - } - } - if (plots.get(world).containsKey(id)) { - plots.get(world).get(id).denied.add(denied); - } + catch (Exception e) { + } return plots; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/PlotMeConverter.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/PlotMeConverter.java index 99ebe7f96..b768e79e4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/PlotMeConverter.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/PlotMeConverter.java @@ -83,213 +83,207 @@ public class PlotMeConverter { return plotConfig.getConfigurationSection("worlds").getKeys(false); } - public void runAsync(final APlotMeConnector connector) throws Exception { - // We have to make it wait a couple of seconds - TaskManager.runTaskLaterAsync(new Runnable() { - @Override - public void run() { + public void run(final APlotMeConnector connector) { + try { + String dataFolder = getPlotMePath(); + FileConfiguration plotConfig = getPlotMeConfig(dataFolder); + + if (plotConfig == null) { + return; + } + + Connection connection = connector.getPlotMeConnection(plotConfig, dataFolder); + + if (connection == null) { + sendMessage("Cannot connect to PlotMe DB. Conversion process will not continue"); + return; + } + + sendMessage("PlotMe conversion has started. To disable this, please set 'plotme-convert.enabled' in the 'settings.yml'"); + sendMessage("Connecting to PlotMe DB"); + + int plotCount = 0; + final ArrayList createdPlots = new ArrayList<>(); + + sendMessage("Collecting plot data"); + sendMessage(" - plotmePlots"); + final Set worlds = getPlotMeWorlds(plotConfig); + HashMap> plots = connector.getPlotMePlots(connection); + for (Entry> entry : plots.entrySet()) { + plotCount += entry.getValue().size(); + } + if (!Settings.CONVERT_PLOTME) { + return; + } + + sendMessage(" - plotmeAllowed"); + + sendMessage("Collected " + plotCount + " plots from PlotMe"); + for (final String world : plots.keySet()) { + sendMessage("Copying config for: " + world); try { - String dataFolder = getPlotMePath(); - FileConfiguration plotConfig = getPlotMeConfig(dataFolder); - - if (plotConfig == null) { - return; + final String plotMeWorldName = world.toLowerCase(); + final Integer pathwidth = plotConfig.getInt("worlds." + plotMeWorldName + ".PathWidth"); // + PlotSquared.config.set("worlds." + world + ".road.width", pathwidth); + final Integer plotsize = plotConfig.getInt("worlds." + plotMeWorldName + ".PlotSize"); // + PlotSquared.config.set("worlds." + world + ".plot.size", plotsize); + final String wallblock = plotConfig.getString("worlds." + plotMeWorldName + ".WallBlockId"); // + PlotSquared.config.set("worlds." + world + ".wall.block", wallblock); + final String floor = plotConfig.getString("worlds." + plotMeWorldName + ".PlotFloorBlockId"); // + PlotSquared.config.set("worlds." + world + ".plot.floor", Arrays.asList(floor)); + final String filling = plotConfig.getString("worlds." + plotMeWorldName + ".PlotFillingBlockId"); // + PlotSquared.config.set("worlds." + world + ".plot.filling", Arrays.asList(filling)); + final String road = plotConfig.getString("worlds." + plotMeWorldName + ".RoadMainBlockId"); + PlotSquared.config.set("worlds." + world + ".road.block", road); + Integer height = plotConfig.getInt("worlds." + plotMeWorldName + ".RoadHeight"); // + if (height == null) { + height = 64; } - - Connection connection = connector.getPlotMeConnection(plotConfig, dataFolder); - - if (connection == null) { - sendMessage("Cannot connect to PlotMe DB. Conversion process will not continue"); - } - - sendMessage("PlotMe conversion has started. To disable this, please set 'plotme-convert.enabled' in the 'settings.yml'"); - sendMessage("Connecting to PlotMe DB"); - - int plotCount = 0; - final ArrayList createdPlots = new ArrayList<>(); - - sendMessage("Collecting plot data"); - sendMessage(" - plotmePlots"); - - final Set worlds = getPlotMeWorlds(plotConfig); - HashMap> plots = connector.getPlotMePlots(connection); - for (Entry> entry : plots.entrySet()) { - plotCount += entry.getValue().size(); - } - - if (!Settings.CONVERT_PLOTME) { - return; - } - - sendMessage(" - plotmeAllowed"); - - sendMessage("Collected " + plotCount + " plots from PlotMe"); + PlotSquared.config.set("worlds." + world + ".road.height", height); + PlotSquared.config.save(PlotSquared.configFile); + } catch (final Exception e) { + sendMessage("&c-- &lFailed to save configuration for world '" + world + "'\nThis will need to be done using the setup command, or manually"); + } + } + final File PLOTME_DG_FILE = new File(dataFolder + File.separator + "PlotMe-DefaultGenerator" + File.separator + "config.yml"); + if (PLOTME_DG_FILE.exists()) { + final YamlConfiguration PLOTME_DG_YML = YamlConfiguration.loadConfiguration(PLOTME_DG_FILE); + try { for (final String world : plots.keySet()) { - sendMessage("Copying config for: " + world); - try { - final String plotMeWorldName = world.toLowerCase(); - final Integer pathwidth = plotConfig.getInt("worlds." + plotMeWorldName + ".PathWidth"); // - PlotSquared.config.set("worlds." + world + ".road.width", pathwidth); - final Integer plotsize = plotConfig.getInt("worlds." + plotMeWorldName + ".PlotSize"); // - PlotSquared.config.set("worlds." + world + ".plot.size", plotsize); - final String wallblock = plotConfig.getString("worlds." + plotMeWorldName + ".WallBlockId"); // - PlotSquared.config.set("worlds." + world + ".wall.block", wallblock); - final String floor = plotConfig.getString("worlds." + plotMeWorldName + ".PlotFloorBlockId"); // - PlotSquared.config.set("worlds." + world + ".plot.floor", Arrays.asList(floor)); - final String filling = plotConfig.getString("worlds." + plotMeWorldName + ".PlotFillingBlockId"); // - PlotSquared.config.set("worlds." + world + ".plot.filling", Arrays.asList(filling)); - final String road = plotConfig.getString("worlds." + plotMeWorldName + ".RoadMainBlockId"); - PlotSquared.config.set("worlds." + world + ".road.block", road); - Integer height = plotConfig.getInt("worlds." + plotMeWorldName + ".RoadHeight"); // - if (height == null) { + final String plotMeWorldName = world.toLowerCase(); + Integer pathwidth = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PathWidth"); // + if (pathwidth == null) { + pathwidth = 7; + } + PlotSquared.config.set("worlds." + world + ".road.width", pathwidth); + Integer plotsize = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PlotSize"); // + if (plotsize == null) { + plotsize = 32; + } + PlotSquared.config.set("worlds." + world + ".plot.size", plotsize); + String wallblock = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".WallBlock"); // + if (wallblock == null) { + wallblock = "44"; + } + PlotSquared.config.set("worlds." + world + ".wall.block", wallblock); + String floor = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".PlotFloorBlock"); // + if (floor == null) { + floor = "2"; + } + PlotSquared.config.set("worlds." + world + ".plot.floor", Arrays.asList(floor)); + String filling = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".FillBlock"); // + if (filling == null) { + filling = "3"; + } + PlotSquared.config.set("worlds." + world + ".plot.filling", Arrays.asList(filling)); + String road = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".RoadMainBlock"); + if (road == null) { + road = "5"; + } + PlotSquared.config.set("worlds." + world + ".road.block", road); + Integer height = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".RoadHeight"); // + if ((height == null) || (height == 0)) { + height = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".GroundHeight"); // + if ((height == null) || (height == 0)) { height = 64; } - PlotSquared.config.set("worlds." + world + ".road.height", height); - PlotSquared.config.save(PlotSquared.configFile); - } catch (final Exception e) { - sendMessage("&c-- &lFailed to save configuration for world '" + world + "'\nThis will need to be done using the setup command, or manually"); } - } - final File PLOTME_DG_FILE = new File(dataFolder + File.separator + "PlotMe-DefaultGenerator" + File.separator + "config.yml"); - if (PLOTME_DG_FILE.exists()) { - final YamlConfiguration PLOTME_DG_YML = YamlConfiguration.loadConfiguration(PLOTME_DG_FILE); - try { - for (final String world : plots.keySet()) { - final String plotMeWorldName = world.toLowerCase(); - Integer pathwidth = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PathWidth"); // - if (pathwidth == null) { - pathwidth = 7; - } - PlotSquared.config.set("worlds." + world + ".road.width", pathwidth); - Integer plotsize = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PlotSize"); // - if (plotsize == null) { - plotsize = 32; - } - PlotSquared.config.set("worlds." + world + ".plot.size", plotsize); - String wallblock = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".WallBlock"); // - if (wallblock == null) { - wallblock = "44"; - } - PlotSquared.config.set("worlds." + world + ".wall.block", wallblock); - String floor = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".PlotFloorBlock"); // - if (floor == null) { - floor = "2"; - } - PlotSquared.config.set("worlds." + world + ".plot.floor", Arrays.asList(floor)); - String filling = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".FillBlock"); // - if (filling == null) { - filling = "3"; - } - PlotSquared.config.set("worlds." + world + ".plot.filling", Arrays.asList(filling)); - String road = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".RoadMainBlock"); - if (road == null) { - road = "5"; - } - PlotSquared.config.set("worlds." + world + ".road.block", road); - Integer height = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".RoadHeight"); // - if ((height == null) || (height == 0)) { - height = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".GroundHeight"); // - if ((height == null) || (height == 0)) { - height = 64; - } - } - PlotSquared.config.set("worlds." + world + ".road.height", height); - PlotSquared.config.set("worlds." + world + ".plot.height", height); - PlotSquared.config.set("worlds." + world + ".wall.height", height); - PlotSquared.config.save(PlotSquared.configFile); - } - } catch (final Exception e) { - } - } - for (final String world : plots.keySet()) { - int duplicate = 0; - for (final Plot plot : plots.get(world).values()) { - if (!PlotSquared.getPlots(world).containsKey(plot.id)) { - createdPlots.add(plot); - } else { - duplicate++; - } - } - if (duplicate > 0) { - PlotSquared.log("&c[WARNING] Found " + duplicate + " duplicate plots already in DB for world: '" + world + "'. Have you run the converter already?"); - } - } - sendMessage("Creating plot DB"); - Thread.sleep(1000); - DBFunc.createPlotsAndData(createdPlots, new Runnable() { - @Override - public void run() { - sendMessage("&aDatabase conversion is now complete!"); - } - }); - sendMessage("Saving configuration..."); - try { + PlotSquared.config.set("worlds." + world + ".road.height", height); + PlotSquared.config.set("worlds." + world + ".plot.height", height); + PlotSquared.config.set("worlds." + world + ".wall.height", height); PlotSquared.config.save(PlotSquared.configFile); - } catch (final IOException e) { - sendMessage(" - &cFailed to save configuration."); } - TaskManager.runTask(new Runnable() { - @Override - public void run() { - try { - boolean MV = false; - boolean MW = false; - if ((Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) && Bukkit.getPluginManager().getPlugin("Multiverse-Core").isEnabled()) { - MV = true; - } else if ((Bukkit.getPluginManager().getPlugin("MultiWorld") != null) && Bukkit.getPluginManager().getPlugin("MultiWorld").isEnabled()) { - MW = true; - } - for (final String worldname : worlds) { - final World world = Bukkit.getWorld(getWorld(worldname)); - if (world == null) { - sendMessage("&cInvalid world in PlotMe configuration: " + worldname); - } - final String actualWorldName = world.getName(); - sendMessage("Reloading generator for world: '" + actualWorldName + "'..."); - PlotSquared.removePlotWorld(actualWorldName); - if (MV) { - // unload world with MV - Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv unload " + actualWorldName); - try { - Thread.sleep(1000); - } catch (final InterruptedException ex) { - Thread.currentThread().interrupt(); - } - // load world with MV - Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv import " + actualWorldName + " normal -g PlotSquared"); - } else if (MW) { - // unload world with MW - Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw unload " + actualWorldName); - try { - Thread.sleep(1000); - } catch (final InterruptedException ex) { - Thread.currentThread().interrupt(); - } - // load world with MW - Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + actualWorldName + " plugin:PlotSquared"); - } else { - // Load using Bukkit API - // - User must set generator manually - Bukkit.getServer().unloadWorld(world, true); - final World myworld = WorldCreator.name(actualWorldName).generator(new HybridGen()).createWorld(); - myworld.save(); - } - } - PlotSquared.setAllPlotsRaw(DBFunc.getPlots()); - } catch (final Exception e) { - e.printStackTrace(); - } - sendMessage("&cPlease wait until database conversion is complete. You will be notified when this happens"); - PlotSquared.log("&c - Stop the server"); - PlotSquared.log("&c - Disable 'plotme-convert.enabled' in the settings.yml"); - PlotSquared.log("&c - Correct any generator settings that haven't copied to 'settings.yml' properly"); - PlotSquared.log("&c - Start the server"); - } - }); } catch (final Exception e) { } } - }, 20); + for (final String world : plots.keySet()) { + int duplicate = 0; + for (final Plot plot : plots.get(world).values()) { + if (!PlotSquared.getPlots(world).containsKey(plot.id)) { + createdPlots.add(plot); + } else { + duplicate++; + } + } + if (duplicate > 0) { + PlotSquared.log("&c[WARNING] Found " + duplicate + " duplicate plots already in DB for world: '" + world + "'. Have you run the converter already?"); + } + } + sendMessage("Creating plot DB"); + Thread.sleep(1000); + DBFunc.createPlotsAndData(createdPlots, new Runnable() { + @Override + public void run() { + sendMessage("&aDatabase conversion is now complete!"); + } + }); + sendMessage("Saving configuration..."); + try { + PlotSquared.config.save(PlotSquared.configFile); + } catch (final IOException e) { + sendMessage(" - &cFailed to save configuration."); + } + TaskManager.runTask(new Runnable() { + @Override + public void run() { + try { + boolean MV = false; + boolean MW = false; + if ((Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) && Bukkit.getPluginManager().getPlugin("Multiverse-Core").isEnabled()) { + MV = true; + } else if ((Bukkit.getPluginManager().getPlugin("MultiWorld") != null) && Bukkit.getPluginManager().getPlugin("MultiWorld").isEnabled()) { + MW = true; + } + for (final String worldname : worlds) { + final World world = Bukkit.getWorld(getWorld(worldname)); + if (world == null) { + sendMessage("&cInvalid world in PlotMe configuration: " + worldname); + } + final String actualWorldName = world.getName(); + sendMessage("Reloading generator for world: '" + actualWorldName + "'..."); + PlotSquared.removePlotWorld(actualWorldName); + if (MV) { + // unload world with MV + Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv unload " + actualWorldName); + try { + Thread.sleep(1000); + } catch (final InterruptedException ex) { + Thread.currentThread().interrupt(); + } + // load world with MV + Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv import " + actualWorldName + " normal -g PlotSquared"); + } else if (MW) { + // unload world with MW + Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw unload " + actualWorldName); + try { + Thread.sleep(1000); + } catch (final InterruptedException ex) { + Thread.currentThread().interrupt(); + } + // load world with MW + Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + actualWorldName + " plugin:PlotSquared"); + } else { + // Load using Bukkit API + // - User must set generator manually + Bukkit.getServer().unloadWorld(world, true); + final World myworld = WorldCreator.name(actualWorldName).generator(new HybridGen()).createWorld(); + myworld.save(); + } + } + PlotSquared.setAllPlotsRaw(DBFunc.getPlots()); + } catch (final Exception e) { + e.printStackTrace(); + } + sendMessage("&cPlease wait until database conversion is complete. You will be notified when this happens"); + PlotSquared.log("&c - Stop the server"); + PlotSquared.log("&c - Disable 'plotme-convert.enabled' in the settings.yml"); + PlotSquared.log("&c - Correct any generator settings that haven't copied to 'settings.yml' properly"); + PlotSquared.log("&c - Start the server"); + } + }); + } catch (final Exception e) { + PlotSquared.log("&/end/"); + } } public static String getWorld(final String world) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 0325ea75c..da4530973 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -420,7 +420,7 @@ public class MainUtil { if (ly) { if (!plot.settings.getMerged(1) || !plot.settings.getMerged(2)) { if (removeRoads) { - manager.removeRoadSouthEast(plotworld, plot); + MainUtil.removeRoadSouthEast(plotworld, plot); } } } @@ -512,7 +512,7 @@ public class MainUtil { lesserPlot.settings.setMerged(2, true); greaterPlot.settings.setMerged(0, true); if (removeRoads) { - manager.removeRoadSouth(plotworld, lesserPlot); + MainUtil.removeRoadSouth(plotworld, lesserPlot); } } } else { @@ -520,7 +520,7 @@ public class MainUtil { lesserPlot.settings.setMerged(1, true); greaterPlot.settings.setMerged(3, true); if (removeRoads) { - manager.removeRoadEast(plotworld, lesserPlot); + MainUtil.removeRoadEast(plotworld, lesserPlot); } } }