mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 18:24:43 +02:00
minor conversion tweaks + fix plot sorting with empty worlds.
This commit is contained in:
@ -98,6 +98,24 @@ public class LikePlotMeConverter {
|
||||
|
||||
public Set<String> getPlotMeWorlds(final FileConfiguration plotConfig) {
|
||||
return plotConfig.getConfigurationSection("worlds").getKeys(false);
|
||||
}
|
||||
|
||||
public void mergeWorldYml(final String plugin, FileConfiguration plotConfig) {
|
||||
try {
|
||||
File genConfig = new File("plugins" + File.separator + plugin + File.separator + "PlotMe-DefaultGenerator" + File.separator + "config.yml");
|
||||
if (genConfig.exists()) {
|
||||
YamlConfiguration yml = YamlConfiguration.loadConfiguration(genConfig);
|
||||
for (String key : yml.getKeys(true)) {
|
||||
if (!plotConfig.contains(key)) {
|
||||
plotConfig.set(key, yml.get(key));
|
||||
}
|
||||
}
|
||||
genConfig.delete();
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateWorldYml(final String plugin, final String location) {
|
||||
@ -139,6 +157,9 @@ public class LikePlotMeConverter {
|
||||
sendMessage("Cannot connect to PlotMe DB. Conversion process will not continue");
|
||||
return false;
|
||||
}
|
||||
|
||||
sendMessage(plugin + " conversion has started. To disable this, please set 'plotme-convert.enabled' in the 'settings.yml'");
|
||||
|
||||
mergeWorldYml(plugin, plotConfig);
|
||||
|
||||
sendMessage("Connecting to " + plugin + " DB");
|
||||
@ -256,6 +277,7 @@ public class LikePlotMeConverter {
|
||||
final AtomicBoolean done = new AtomicBoolean(false);
|
||||
DBFunc.createPlotsAndData(createdPlots, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (done.get()) {
|
||||
done();
|
||||
sendMessage("&aDatabase conversion is now complete!");
|
||||
@ -325,6 +347,7 @@ public class LikePlotMeConverter {
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (done.get()) {
|
||||
done();
|
||||
sendMessage("&aDatabase conversion is now complete!");
|
||||
@ -342,4 +365,8 @@ public class LikePlotMeConverter {
|
||||
e.printStackTrace();
|
||||
PS.debug("&/end/");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void done() {
|
||||
PS.get().setAllPlotsRaw(DBFunc.getPlots());
|
||||
|
Reference in New Issue
Block a user