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)) {
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) {
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);
merges.put(world, new HashMap<PlotId,boolean[]>());
}
}

View File

@ -150,33 +150,35 @@ public class LikePlotMeConverter {
sendMessage(" - " + dbPrefix + "Plots");
final Set<String> worlds = getPlotMeWorlds(plotConfig);
sendMessage("Updating bukkit.yml");
updateWorldYml(plugin, "bukkit.yml");
updateWorldYml(plugin, "plugins/Multiverse-Core/worlds.yml");
for (final String world : plotConfig.getConfigurationSection("worlds").getKeys(false)) {
sendMessage("Copying config for: " + world);
try {
String actualWorldName = getWorld(world);
final Integer pathwidth = plotConfig.getInt("worlds." + world + ".PathWidth"); //
PS.get().config.set("worlds." + actualWorldName + ".road.width", pathwidth);
final Integer plotsize = plotConfig.getInt("worlds." + world + ".PlotSize"); //
PS.get().config.set("worlds." + actualWorldName + ".plot.size", plotsize);
final String wallblock = plotConfig.getString("worlds." + world + ".WallBlockId"); //
PS.get().config.set("worlds." + actualWorldName + ".wall.block", wallblock);
final String floor = plotConfig.getString("worlds." + world + ".PlotFloorBlockId"); //
PS.get().config.set("worlds." + actualWorldName + ".plot.floor", Arrays.asList(floor));
final String filling = plotConfig.getString("worlds." + world + ".PlotFillingBlockId"); //
PS.get().config.set("worlds." + actualWorldName + ".plot.filling", Arrays.asList(filling));
final String road = plotConfig.getString("worlds." + world + ".RoadMainBlockId");
PS.get().config.set("worlds." + actualWorldName + ".road.block", road);
Integer height = plotConfig.getInt("worlds." + world + ".RoadHeight"); //
if (height == null) {
height = 64;
if (!Settings.CONVERT_PLOTME) {
sendMessage("Updating bukkit.yml");
updateWorldYml(plugin, "bukkit.yml");
updateWorldYml(plugin, "plugins/Multiverse-Core/worlds.yml");
for (final String world : plotConfig.getConfigurationSection("worlds").getKeys(false)) {
sendMessage("Copying config for: " + world);
try {
String actualWorldName = getWorld(world);
final Integer pathwidth = plotConfig.getInt("worlds." + world + ".PathWidth"); //
PS.get().config.set("worlds." + actualWorldName + ".road.width", pathwidth);
final Integer plotsize = plotConfig.getInt("worlds." + world + ".PlotSize"); //
PS.get().config.set("worlds." + actualWorldName + ".plot.size", plotsize);
final String wallblock = plotConfig.getString("worlds." + world + ".WallBlockId"); //
PS.get().config.set("worlds." + actualWorldName + ".wall.block", wallblock);
final String floor = plotConfig.getString("worlds." + world + ".PlotFloorBlockId"); //
PS.get().config.set("worlds." + actualWorldName + ".plot.floor", Arrays.asList(floor));
final String filling = plotConfig.getString("worlds." + world + ".PlotFillingBlockId"); //
PS.get().config.set("worlds." + actualWorldName + ".plot.filling", Arrays.asList(filling));
final String road = plotConfig.getString("worlds." + world + ".RoadMainBlockId");
PS.get().config.set("worlds." + actualWorldName + ".road.block", road);
Integer height = plotConfig.getInt("worlds." + world + ".RoadHeight"); //
if (height == null) {
height = 64;
}
PS.get().config.set("worlds." + actualWorldName + ".road.height", height);
PS.get().config.save(PS.get().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");
}
PS.get().config.set("worlds." + actualWorldName + ".road.height", height);
PS.get().config.save(PS.get().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");
}
}

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)) {
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) {
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);
merges.put(world, new HashMap<PlotId,boolean[]>());
}
}