mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 23:26:45 +01:00
PlotMe cache for offline-mode
This commit is contained in:
parent
8b62ba9d65
commit
6927351bfb
@ -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.9.0</version>
|
<version>2.9.1</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -75,8 +75,10 @@ public class PlotMeConverter {
|
|||||||
if (!plotMeFile.exists()) {
|
if (!plotMeFile.exists()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage("PlotMe conversion has started. To disable this, please set 'plotme-convert.enabled' in the 'settings.yml'");
|
sendMessage("PlotMe conversion has started. To disable this, please set 'plotme-convert.enabled' in the 'settings.yml'");
|
||||||
sendMessage("Connecting to PlotMe DB");
|
sendMessage("Connecting to PlotMe DB");
|
||||||
|
|
||||||
final FileConfiguration plotConfig = YamlConfiguration.loadConfiguration(plotMeFile);
|
final FileConfiguration plotConfig = YamlConfiguration.loadConfiguration(plotMeFile);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
Connection connection;
|
Connection connection;
|
||||||
@ -90,6 +92,7 @@ public class PlotMeConverter {
|
|||||||
}
|
}
|
||||||
sendMessage("Collecting plot data");
|
sendMessage("Collecting plot data");
|
||||||
sendMessage(" - plotmePlots");
|
sendMessage(" - plotmePlots");
|
||||||
|
|
||||||
ResultSet r;
|
ResultSet r;
|
||||||
Statement stmt;
|
Statement stmt;
|
||||||
final HashMap<String, Integer> plotSize = new HashMap<>();
|
final HashMap<String, Integer> plotSize = new HashMap<>();
|
||||||
@ -97,7 +100,6 @@ public class PlotMeConverter {
|
|||||||
final Set<String> worlds = plotConfig.getConfigurationSection("worlds").getKeys(false);
|
final Set<String> worlds = plotConfig.getConfigurationSection("worlds").getKeys(false);
|
||||||
stmt = connection.createStatement();
|
stmt = connection.createStatement();
|
||||||
r = stmt.executeQuery("SELECT * FROM `plotmePlots`");
|
r = stmt.executeQuery("SELECT * FROM `plotmePlots`");
|
||||||
// TODO check if r contains UUID collumn -> assign var
|
|
||||||
|
|
||||||
boolean checkUUID = DBFunc.hasColumn(r, "ownerid");
|
boolean checkUUID = DBFunc.hasColumn(r, "ownerid");
|
||||||
|
|
||||||
@ -137,6 +139,9 @@ public class PlotMeConverter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
UUIDHandler.add(new StringWrapper(name), owner);
|
||||||
|
}
|
||||||
final Plot plot = new Plot(id, owner, new ArrayList<UUID>(), new ArrayList<UUID>(), world);
|
final Plot plot = new Plot(id, owner, new ArrayList<UUID>(), new ArrayList<UUID>(), world);
|
||||||
plots.get(world).put(id, plot);
|
plots.get(world).put(id, plot);
|
||||||
}
|
}
|
||||||
@ -156,7 +161,6 @@ public class PlotMeConverter {
|
|||||||
if (name.equals("*")) {
|
if (name.equals("*")) {
|
||||||
helper = DBFunc.everyone;
|
helper = DBFunc.everyone;
|
||||||
} else {
|
} else {
|
||||||
// TODO check PlotMe table for UUID
|
|
||||||
sendMessage("&6Could not identify helper for plot: " + id);
|
sendMessage("&6Could not identify helper for plot: " + id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -176,7 +180,6 @@ public class PlotMeConverter {
|
|||||||
if (name.equals("*")) {
|
if (name.equals("*")) {
|
||||||
denied = DBFunc.everyone;
|
denied = DBFunc.everyone;
|
||||||
} else {
|
} else {
|
||||||
// TODO check PlotMe table for UUID
|
|
||||||
sendMessage("&6Could not identify denied for plot: " + id);
|
sendMessage("&6Could not identify denied for plot: " + id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -302,26 +305,28 @@ public class PlotMeConverter {
|
|||||||
sendMessage("Reloading generator for world: '" + actualWorldName + "'...");
|
sendMessage("Reloading generator for world: '" + actualWorldName + "'...");
|
||||||
PlotSquared.removePlotWorld(actualWorldName);
|
PlotSquared.removePlotWorld(actualWorldName);
|
||||||
if (MV) {
|
if (MV) {
|
||||||
// unload
|
// unload world with MV
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv unload " + actualWorldName);
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv unload " + actualWorldName);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (final InterruptedException ex) {
|
} catch (final InterruptedException ex) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
// load
|
// load world with MV
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv import " + actualWorldName + " normal -g PlotSquared");
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv import " + actualWorldName + " normal -g PlotSquared");
|
||||||
} else if (MW) {
|
} else if (MW) {
|
||||||
// unload
|
// unload world with MW
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw unload " + actualWorldName);
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw unload " + actualWorldName);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (final InterruptedException ex) {
|
} catch (final InterruptedException ex) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
// load
|
// load world with MW
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + actualWorldName + " plugin:PlotSquared");
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + actualWorldName + " plugin:PlotSquared");
|
||||||
} else {
|
} else {
|
||||||
|
// Load using Bukkit API
|
||||||
|
// - User must set generator manually
|
||||||
Bukkit.getServer().unloadWorld(world, true);
|
Bukkit.getServer().unloadWorld(world, true);
|
||||||
final World myworld = WorldCreator.name(actualWorldName).generator(new HybridGen()).createWorld();
|
final World myworld = WorldCreator.name(actualWorldName).generator(new HybridGen()).createWorld();
|
||||||
myworld.save();
|
myworld.save();
|
||||||
|
Loading…
Reference in New Issue
Block a user