Fixed PlotMe UUID caching without conversion

This commit is contained in:
boy0001 2015-07-14 07:19:20 +10:00
parent 5e8a2df4e9
commit 4711c7c8ab
5 changed files with 53 additions and 49 deletions

View File

@ -8,7 +8,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>2.12.4</version> <version>2.12.5</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>

View File

@ -192,18 +192,18 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} else { } else {
log("&dUsing metrics will allow us to improve the plugin, please consider it :)"); log("&dUsing metrics will allow us to improve the plugin, please consider it :)");
} }
File file = new File(this.getDirectory() + File.separator + "disabled.yml"); // File file = new File(this.getDirectory() + File.separator + "disabled.yml");
if (file.exists()) { // if (file.exists()) {
try { // file.delete();
String[] split = new String(Files.readAllBytes(file.toPath())).split(","); // try {
for (String plugin : split) { // String[] split = new String(Files.readAllBytes(file.toPath())).split(",");
loadPlugin(plugin); // for (String plugin : split) {
} // loadPlugin(plugin);
} catch (IOException e) { // }
e.printStackTrace(); // } catch (IOException e) {
} // e.printStackTrace();
file.delete(); // }
} // }
List<World> worlds = Bukkit.getWorlds(); List<World> worlds = Bukkit.getWorlds();
if (worlds.size() > 0) { if (worlds.size() > 0) {
UUIDHandler.cacheAll(worlds.get(0).getName()); UUIDHandler.cacheAll(worlds.get(0).getName());

View File

@ -15,6 +15,7 @@ import org.bukkit.World;
import com.intellectualcrafters.configuration.file.FileConfiguration; import com.intellectualcrafters.configuration.file.FileConfiguration;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.database.SQLite; import com.intellectualcrafters.plot.database.SQLite;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
@ -57,18 +58,18 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "Plots`"); stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "Plots`");
r = stmt.executeQuery(); r = stmt.executeQuery();
boolean checkUUID = DBFunc.hasColumn(r, "ownerid"); boolean checkUUID = DBFunc.hasColumn(r, "ownerid");
boolean merge = !plugin.equals("plotme"); boolean merge = !plugin.equals("plotme") && Settings.CONVERT_PLOTME;
while (r.next()) { while (r.next()) {
final PlotId id = new PlotId(r.getInt("idX"), r.getInt("idZ")); final PlotId id = new PlotId(r.getInt("idX"), r.getInt("idZ"));
final String name = r.getString("owner"); final String name = r.getString("owner");
final String world = LikePlotMeConverter.getWorld(r.getString("world")); final String world = LikePlotMeConverter.getWorld(r.getString("world"));
if (!plots.containsKey(world)) { if (!plots.containsKey(world)) {
plots.put(world, new HashMap<PlotId, Plot>());
if (merge) {
int plot = PS.get().config.getInt("worlds." + world + ".plot.size"); int plot = PS.get().config.getInt("worlds." + world + ".plot.size");
int path = PS.get().config.getInt("worlds." + world + ".road.width"); int path = PS.get().config.getInt("worlds." + world + ".road.width");
plotWidth.put(world, plot); plotWidth.put(world, plot);
roadWidth.put(world, path); roadWidth.put(world, path);
plots.put(world, new HashMap<PlotId, Plot>());
if (merge) {
merges.put(world, new HashMap<PlotId,boolean[]>()); merges.put(world, new HashMap<PlotId,boolean[]>());
} }
} }

View File

@ -150,6 +150,7 @@ public class LikePlotMeConverter {
sendMessage(" - " + dbPrefix + "Plots"); sendMessage(" - " + dbPrefix + "Plots");
final Set<String> worlds = getPlotMeWorlds(plotConfig); final Set<String> worlds = getPlotMeWorlds(plotConfig);
if (!Settings.CONVERT_PLOTME) {
sendMessage("Updating bukkit.yml"); sendMessage("Updating bukkit.yml");
updateWorldYml(plugin, "bukkit.yml"); updateWorldYml(plugin, "bukkit.yml");
updateWorldYml(plugin, "plugins/Multiverse-Core/worlds.yml"); updateWorldYml(plugin, "plugins/Multiverse-Core/worlds.yml");
@ -179,6 +180,7 @@ public class LikePlotMeConverter {
sendMessage("&c-- &lFailed to save configuration for world '" + world + "'\nThis will need to be done using the setup command, or manually"); sendMessage("&c-- &lFailed to save configuration for world '" + world + "'\nThis will need to be done using the setup command, or manually");
} }
} }
}
HashMap<String, HashMap<PlotId, Plot>> plots = connector.getPlotMePlots(connection); HashMap<String, HashMap<PlotId, Plot>> plots = connector.getPlotMePlots(connection);
for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) { for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {

View File

@ -12,6 +12,7 @@ import java.util.Map.Entry;
import com.intellectualcrafters.configuration.file.FileConfiguration; import com.intellectualcrafters.configuration.file.FileConfiguration;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.database.SQLite; import com.intellectualcrafters.plot.database.SQLite;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
@ -56,18 +57,18 @@ public class PlotMeConnector_017 extends APlotMeConnector {
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_plots`"); stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_plots`");
r = stmt.executeQuery(); r = stmt.executeQuery();
boolean checkUUID = DBFunc.hasColumn(r, "ownerID"); boolean checkUUID = DBFunc.hasColumn(r, "ownerID");
boolean merge = !plugin.equals("plotme"); boolean merge = !plugin.equals("plotme") && Settings.CONVERT_PLOTME;
while (r.next()) { while (r.next()) {
int key = r.getInt("plot_id"); int key = r.getInt("plot_id");
PlotId id = new PlotId(r.getInt("plotX"), r.getInt("plotZ")); PlotId id = new PlotId(r.getInt("plotX"), r.getInt("plotZ"));
String name = r.getString("owner"); String name = r.getString("owner");
String world = LikePlotMeConverter.getWorld(r.getString("world")); String world = LikePlotMeConverter.getWorld(r.getString("world"));
if (!plots.containsKey(world)) { if (!plots.containsKey(world)) {
if (merge) {
int plot = PS.get().config.getInt("worlds." + world + ".plot.size"); int plot = PS.get().config.getInt("worlds." + world + ".plot.size");
int path = PS.get().config.getInt("worlds." + world + ".road.width"); int path = PS.get().config.getInt("worlds." + world + ".road.width");
plotWidth.put(world, plot); plotWidth.put(world, plot);
roadWidth.put(world, path); roadWidth.put(world, path);
if (merge) {
merges.put(world, new HashMap<PlotId,boolean[]>()); merges.put(world, new HashMap<PlotId,boolean[]>());
} }
} }