diff --git a/pom.xml b/pom.xml index 978bbb6fb..db657e472 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ UTF-8 PlotSquared - 3.1.9 + 3.1.10 PlotSquared jar diff --git a/src/main/java/com/intellectualcrafters/plot/PS.java b/src/main/java/com/intellectualcrafters/plot/PS.java index 7466c62d3..de195d462 100644 --- a/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/src/main/java/com/intellectualcrafters/plot/PS.java @@ -559,7 +559,9 @@ public class PS { } final Set result = new HashSet<>(size); for (final Entry> entry : plots.entrySet()) { - result.addAll(entry.getValue().values()); + for (Entry entry2 : entry.getValue().entrySet()) { + result.add(entry2.getValue()); + } } return result; } @@ -961,13 +963,13 @@ public class PS { for (final String world : worlds) { switch (type) { case CREATION_DATE: - toReturn.addAll(sortPlotsByTemp(map.get(world))); + toReturn.addAll(sortPlotsByTemp(getPlotsInWorld(world))); break; case CREATION_DATE_TIMESTAMP: - toReturn.addAll(sortPlotsByTimestamp(map.get(world))); + toReturn.addAll(sortPlotsByTimestamp(getPlotsInWorld(world))); break; case DISTANCE_FROM_ORIGIN: - toReturn.addAll(sortPlotsByHash(map.get(world))); + toReturn.addAll(sortPlotsByHash(getPlotsInWorld(world))); break; default: break; diff --git a/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java b/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java index b2a9a6994..c30e4d061 100644 --- a/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java +++ b/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java @@ -27,10 +27,15 @@ import com.intellectualcrafters.plot.util.UUIDHandler; public class ClassicPlotMeConnector extends APlotMeConnector { private String plugin; + private String prefix; @Override public Connection getPlotMeConnection(final String plugin, final FileConfiguration plotConfig, final String dataFolder) { this.plugin = plugin.toLowerCase(); + prefix = plotConfig.getString("mySQLprefix"); + if (prefix == null) { + prefix = plugin; + } try { if (plotConfig.getBoolean("usemySQL")) { final String user = plotConfig.getString("mySQLuname"); @@ -53,7 +58,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector { final HashMap roadWidth = new HashMap<>(); final HashMap> plots = new HashMap<>(); final HashMap> merges = new HashMap<>(); - stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "Plots`"); + stmt = connection.prepareStatement("SELECT * FROM `" + prefix + "Plots`"); r = stmt.executeQuery(); String column = null; final boolean checkUUID = DBFunc.hasColumn(r, "ownerid"); @@ -166,8 +171,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector { try { - MainUtil.sendConsoleMessage(" - " + plugin + "Denied"); - stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "Denied`"); + MainUtil.sendConsoleMessage(" - " + prefix + "Denied"); + stmt = connection.prepareStatement("SELECT * FROM `" + prefix + "Denied`"); r = stmt.executeQuery(); while (r.next()) { @@ -267,6 +272,6 @@ public class ClassicPlotMeConnector extends APlotMeConnector { if (version == null) { return true; } - return PS.get().canUpdate(version, "0.17.0"); + return PS.get().canUpdate(version, "0.17.0") || PS.get().canUpdate("0.999.999", version); } } diff --git a/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java b/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java index e643ef807..56f5093e0 100644 --- a/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java +++ b/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java @@ -98,6 +98,24 @@ public class LikePlotMeConverter { return plotConfig.getConfigurationSection("worlds").getKeys(false); } + public void mergeWorldYml(final String plugin, FileConfiguration plotConfig) { + try { + File genConfig = new File("plugins" + File.separator + plugin + File.separator + "PlotMe-DefaultGenerator" + File.separator + "config.yml"); + if (genConfig.exists()) { + YamlConfiguration yml = YamlConfiguration.loadConfiguration(genConfig); + for (String key : yml.getKeys(true)) { + if (!plotConfig.contains(key)) { + plotConfig.set(key, yml.get(key)); + } + } + genConfig.delete(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + public void updateWorldYml(final String plugin, final String location) { try { final Path path = Paths.get(location); @@ -139,6 +157,9 @@ public class LikePlotMeConverter { } sendMessage(plugin + " conversion has started. To disable this, please set 'plotme-convert.enabled' in the 'settings.yml'"); + + mergeWorldYml(plugin, plotConfig); + sendMessage("Connecting to " + plugin + " DB"); int plotCount = 0; @@ -256,6 +277,7 @@ public class LikePlotMeConverter { @Override public void run() { if (done.get()) { + done(); sendMessage("&aDatabase conversion is now complete!"); PS.debug("&c - Stop the server"); PS.debug("&c - Disable 'plotme-convert.enabled' and 'plotme-convert.cache-uuids' in the settings.yml"); @@ -325,6 +347,7 @@ public class LikePlotMeConverter { e.printStackTrace(); } if (done.get()) { + done(); sendMessage("&aDatabase conversion is now complete!"); PS.debug("&c - Stop the server"); PS.debug("&c - Disable 'plotme-convert.enabled' and 'plotme-convert.cache-uuids' in the settings.yml"); @@ -342,4 +365,8 @@ public class LikePlotMeConverter { } return true; } + + public void done() { + PS.get().setAllPlotsRaw(DBFunc.getPlots()); + } } diff --git a/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java b/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java index 8fa7fe299..7d8f2912f 100644 --- a/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java +++ b/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java @@ -24,10 +24,12 @@ import com.intellectualcrafters.plot.util.UUIDHandler; public class PlotMeConnector_017 extends APlotMeConnector { private String plugin; + private String prefix; @Override public Connection getPlotMeConnection(final String plugin, final FileConfiguration plotConfig, final String dataFolder) { this.plugin = plugin.toLowerCase(); + prefix = plugin + "core_"; try { if (plotConfig.getBoolean("usemySQL")) { final String user = plotConfig.getString("mySQLuname"); diff --git a/target/PlotSquared-Bukkit.jar b/target/PlotSquared-Bukkit.jar index 41abe5c81..586e15374 100644 Binary files a/target/PlotSquared-Bukkit.jar and b/target/PlotSquared-Bukkit.jar differ diff --git a/target/PlotSquared-Sponge.jar b/target/PlotSquared-Sponge.jar index c1a96a055..bb7a9ca4b 100644 Binary files a/target/PlotSquared-Sponge.jar and b/target/PlotSquared-Sponge.jar differ