mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Fixed PlotMe UUID caching without conversion
This commit is contained in:
parent
5e8a2df4e9
commit
4711c7c8ab
@ -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>
|
||||||
|
@ -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());
|
||||||
|
@ -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)) {
|
||||||
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>());
|
plots.put(world, new HashMap<PlotId, Plot>());
|
||||||
if (merge) {
|
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[]>());
|
merges.put(world, new HashMap<PlotId,boolean[]>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,33 +150,35 @@ public class LikePlotMeConverter {
|
|||||||
sendMessage(" - " + dbPrefix + "Plots");
|
sendMessage(" - " + dbPrefix + "Plots");
|
||||||
final Set<String> worlds = getPlotMeWorlds(plotConfig);
|
final Set<String> worlds = getPlotMeWorlds(plotConfig);
|
||||||
|
|
||||||
sendMessage("Updating bukkit.yml");
|
if (!Settings.CONVERT_PLOTME) {
|
||||||
updateWorldYml(plugin, "bukkit.yml");
|
sendMessage("Updating bukkit.yml");
|
||||||
updateWorldYml(plugin, "plugins/Multiverse-Core/worlds.yml");
|
updateWorldYml(plugin, "bukkit.yml");
|
||||||
for (final String world : plotConfig.getConfigurationSection("worlds").getKeys(false)) {
|
updateWorldYml(plugin, "plugins/Multiverse-Core/worlds.yml");
|
||||||
sendMessage("Copying config for: " + world);
|
for (final String world : plotConfig.getConfigurationSection("worlds").getKeys(false)) {
|
||||||
try {
|
sendMessage("Copying config for: " + world);
|
||||||
String actualWorldName = getWorld(world);
|
try {
|
||||||
final Integer pathwidth = plotConfig.getInt("worlds." + world + ".PathWidth"); //
|
String actualWorldName = getWorld(world);
|
||||||
PS.get().config.set("worlds." + actualWorldName + ".road.width", pathwidth);
|
final Integer pathwidth = plotConfig.getInt("worlds." + world + ".PathWidth"); //
|
||||||
final Integer plotsize = plotConfig.getInt("worlds." + world + ".PlotSize"); //
|
PS.get().config.set("worlds." + actualWorldName + ".road.width", pathwidth);
|
||||||
PS.get().config.set("worlds." + actualWorldName + ".plot.size", plotsize);
|
final Integer plotsize = plotConfig.getInt("worlds." + world + ".PlotSize"); //
|
||||||
final String wallblock = plotConfig.getString("worlds." + world + ".WallBlockId"); //
|
PS.get().config.set("worlds." + actualWorldName + ".plot.size", plotsize);
|
||||||
PS.get().config.set("worlds." + actualWorldName + ".wall.block", wallblock);
|
final String wallblock = plotConfig.getString("worlds." + world + ".WallBlockId"); //
|
||||||
final String floor = plotConfig.getString("worlds." + world + ".PlotFloorBlockId"); //
|
PS.get().config.set("worlds." + actualWorldName + ".wall.block", wallblock);
|
||||||
PS.get().config.set("worlds." + actualWorldName + ".plot.floor", Arrays.asList(floor));
|
final String floor = plotConfig.getString("worlds." + world + ".PlotFloorBlockId"); //
|
||||||
final String filling = plotConfig.getString("worlds." + world + ".PlotFillingBlockId"); //
|
PS.get().config.set("worlds." + actualWorldName + ".plot.floor", Arrays.asList(floor));
|
||||||
PS.get().config.set("worlds." + actualWorldName + ".plot.filling", Arrays.asList(filling));
|
final String filling = plotConfig.getString("worlds." + world + ".PlotFillingBlockId"); //
|
||||||
final String road = plotConfig.getString("worlds." + world + ".RoadMainBlockId");
|
PS.get().config.set("worlds." + actualWorldName + ".plot.filling", Arrays.asList(filling));
|
||||||
PS.get().config.set("worlds." + actualWorldName + ".road.block", road);
|
final String road = plotConfig.getString("worlds." + world + ".RoadMainBlockId");
|
||||||
Integer height = plotConfig.getInt("worlds." + world + ".RoadHeight"); //
|
PS.get().config.set("worlds." + actualWorldName + ".road.block", road);
|
||||||
if (height == null) {
|
Integer height = plotConfig.getInt("worlds." + world + ".RoadHeight"); //
|
||||||
height = 64;
|
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");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)) {
|
||||||
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) {
|
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[]>());
|
merges.put(world, new HashMap<PlotId,boolean[]>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user