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>
</properties>
<artifactId>PlotSquared</artifactId>
<version>2.12.4</version>
<version>2.12.5</version>
<name>PlotSquared</name>
<packaging>jar</packaging>
<build>

View File

@ -192,18 +192,18 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} else {
log("&dUsing metrics will allow us to improve the plugin, please consider it :)");
}
File file = new File(this.getDirectory() + File.separator + "disabled.yml");
if (file.exists()) {
try {
String[] split = new String(Files.readAllBytes(file.toPath())).split(",");
for (String plugin : split) {
loadPlugin(plugin);
}
} catch (IOException e) {
e.printStackTrace();
}
file.delete();
}
// File file = new File(this.getDirectory() + File.separator + "disabled.yml");
// if (file.exists()) {
// file.delete();
// try {
// String[] split = new String(Files.readAllBytes(file.toPath())).split(",");
// for (String plugin : split) {
// loadPlugin(plugin);
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
List<World> worlds = Bukkit.getWorlds();
if (worlds.size() > 0) {
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.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.database.SQLite;
import com.intellectualcrafters.plot.object.Location;
@ -57,18 +58,18 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "Plots`");
r = stmt.executeQuery();
boolean checkUUID = DBFunc.hasColumn(r, "ownerid");
boolean merge = !plugin.equals("plotme");
boolean merge = !plugin.equals("plotme") && Settings.CONVERT_PLOTME;
while (r.next()) {
final PlotId id = new PlotId(r.getInt("idX"), r.getInt("idZ"));
final String name = r.getString("owner");
final String world = LikePlotMeConverter.getWorld(r.getString("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 path = PS.get().config.getInt("worlds." + world + ".road.width");
plotWidth.put(world, plot);
roadWidth.put(world, path);
plots.put(world, new HashMap<PlotId, Plot>());
if (merge) {
merges.put(world, new HashMap<PlotId,boolean[]>());
}
}

View File

@ -150,6 +150,7 @@ public class LikePlotMeConverter {
sendMessage(" - " + dbPrefix + "Plots");
final Set<String> worlds = getPlotMeWorlds(plotConfig);
if (!Settings.CONVERT_PLOTME) {
sendMessage("Updating bukkit.yml");
updateWorldYml(plugin, "bukkit.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");
}
}
}
HashMap<String, HashMap<PlotId, Plot>> plots = connector.getPlotMePlots(connection);
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.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.database.SQLite;
import com.intellectualcrafters.plot.object.Location;
@ -56,18 +57,18 @@ public class PlotMeConnector_017 extends APlotMeConnector {
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_plots`");
r = stmt.executeQuery();
boolean checkUUID = DBFunc.hasColumn(r, "ownerID");
boolean merge = !plugin.equals("plotme");
boolean merge = !plugin.equals("plotme") && Settings.CONVERT_PLOTME;
while (r.next()) {
int key = r.getInt("plot_id");
PlotId id = new PlotId(r.getInt("plotX"), r.getInt("plotZ"));
String name = r.getString("owner");
String world = LikePlotMeConverter.getWorld(r.getString("world"));
if (!plots.containsKey(world)) {
if (merge) {
int plot = PS.get().config.getInt("worlds." + world + ".plot.size");
int path = PS.get().config.getInt("worlds." + world + ".road.width");
plotWidth.put(world, plot);
roadWidth.put(world, path);
if (merge) {
merges.put(world, new HashMap<PlotId,boolean[]>());
}
}