mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 11:55:38 +01:00
Finished new PlotMeConverter
This commit is contained in:
parent
c57e518143
commit
5e27ff52b8
@ -6,6 +6,7 @@ public abstract class PlotGenerator extends ChunkGenerator {
|
||||
|
||||
public PlotGenerator(String world) {
|
||||
PlotMain.loadWorld(world, this);
|
||||
System.out.print("LOADED");
|
||||
}
|
||||
|
||||
public abstract PlotWorld getNewPlotWorld(String world);
|
||||
|
@ -1395,6 +1395,12 @@ public class PlotMain extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public static void removePlotWorld(String world) {
|
||||
plots.remove(world);
|
||||
managers.remove(world);
|
||||
worlds.remove(world);
|
||||
}
|
||||
|
||||
public static HashMap<String, HashMap<PlotId, Plot>> getAllPlotsRaw() {
|
||||
return plots;
|
||||
}
|
||||
|
@ -48,6 +48,8 @@ public class Purge extends SubCommand {
|
||||
}
|
||||
PlotMain.getPlots(world).remove(id);
|
||||
DBFunc.purge(world, id);
|
||||
PlayerFunctions.sendMessage(plr, "&aPurge of '"+args[0]+"' was successful!");
|
||||
return true;
|
||||
}
|
||||
catch (Exception e) {
|
||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
||||
@ -66,6 +68,7 @@ public class Purge extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE));
|
||||
return false;
|
||||
}
|
||||
PlotMain.removePlotWorld(args[0]);
|
||||
DBFunc.purge(args[0]);
|
||||
PlayerFunctions.sendMessage(plr, (C.PURGE_SUCCESS));
|
||||
return true;
|
||||
|
@ -96,7 +96,6 @@ public class Setup extends SubCommand implements Listener {
|
||||
+ " plugin:" + object.plugin);
|
||||
}
|
||||
else {
|
||||
|
||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||
if (plugin.isEnabled()) {
|
||||
if (plugin.getDefaultWorldGenerator("world", "") != null) {
|
||||
@ -112,9 +111,6 @@ public class Setup extends SubCommand implements Listener {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
object.getPlugin();
|
||||
// World world = WorldCreator.name("SkyWorld").generator(new object. ).createWorld();
|
||||
}
|
||||
}
|
||||
sendMessage(plr, C.SETUP_FINISHED, object.world);
|
||||
|
@ -483,12 +483,10 @@ public class DBFunc {
|
||||
plots.get(worldname).put((plot_id), p);
|
||||
}
|
||||
else {
|
||||
if (worlds.contains(p.world)) {
|
||||
HashMap<PlotId, Plot> map = new HashMap<PlotId, Plot>();
|
||||
map.put((plot_id), p);
|
||||
plots.put(worldname, map);
|
||||
}
|
||||
else {
|
||||
HashMap<PlotId, Plot> map = new HashMap<PlotId, Plot>();
|
||||
map.put((plot_id), p);
|
||||
plots.put(worldname, map);
|
||||
if (!worlds.contains(p.world)) {
|
||||
if (noExist.containsKey(worldname)) {
|
||||
noExist.put(worldname,noExist.get(worldname)+1);
|
||||
}
|
||||
@ -499,7 +497,7 @@ public class DBFunc {
|
||||
}
|
||||
}
|
||||
for (String worldname: noExist.keySet()) {
|
||||
PlotMain.sendConsoleSenderMessage("&4[WARNING] Found "+noExist.get(worldname)+" plots in DB for non existant world; '"+worldname+"'!!!\n&c - Please create this world, or remove the plots from the DB using the purge command!");
|
||||
PlotMain.sendConsoleSenderMessage("&c[WARNING] Found "+noExist.get(worldname)+" plots in DB for non existant world; '"+worldname+"'!!!\n&c - Please create this world, or remove the plots from the DB using the purge command!");
|
||||
}
|
||||
stmt.close();
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class PlotMeConverter {
|
||||
}
|
||||
|
||||
if (pl != null) {
|
||||
if (!PlotMain.getPlots(world).containsKey(pl.id)) {
|
||||
if (!PlotMain.getPlots(world).containsKey(id)) {
|
||||
createdPlots.add(pl);
|
||||
}
|
||||
else {
|
||||
@ -228,7 +228,7 @@ public class PlotMeConverter {
|
||||
}
|
||||
}
|
||||
if (duplicate>0) {
|
||||
PlotMain.sendConsoleSenderMessage("&4[WARNING] Found "+duplicate+" duplicate plots already in DB for world: '"+world.getName()+"'. Have you run the converter already?");
|
||||
PlotMain.sendConsoleSenderMessage("&c[WARNING] Found "+duplicate+" duplicate plots already in DB for world: '"+world.getName()+"'. Have you run the converter already?");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -239,7 +239,7 @@ public class PlotMeConverter {
|
||||
// TODO createPlot doesn't add denied users
|
||||
DBFunc.createAllSettingsAndHelpers(createdPlots);
|
||||
stream.close();
|
||||
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: Saving configuration...");
|
||||
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8:&7 Saving configuration...");
|
||||
try {
|
||||
PlotMain.config.save(PlotMain.configFile);
|
||||
} catch (IOException e) {
|
||||
@ -258,16 +258,29 @@ public class PlotMeConverter {
|
||||
|
||||
for (String worldname : worlds) {
|
||||
World world = Bukkit.getWorld(worldname);
|
||||
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: Reloading generator for world: '"+worldname+"'...");
|
||||
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8:&7 Reloading generator for world: '"+worldname+"'...");
|
||||
|
||||
PlotMain.removePlotWorld(worldname);
|
||||
|
||||
if (MV) {
|
||||
// unload
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv unload " + worldname);
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch(InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
// load
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv import " + worldname + " normal -g PlotSquared");
|
||||
}
|
||||
else if (MW) {
|
||||
// unload
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw unload " + worldname);
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch(InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
// load
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + worldname+" plugin:PlotSquared");
|
||||
}
|
||||
@ -280,9 +293,10 @@ public class PlotMeConverter {
|
||||
|
||||
PlotMain.setAllPlotsRaw(DBFunc.getPlots());
|
||||
|
||||
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: Disabling PlotMe...");
|
||||
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8:&7 Disabling PlotMe...");
|
||||
Bukkit.getPluginManager().disablePlugin(plotMePlugin);
|
||||
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: &7Conversion has finished");
|
||||
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8:&7 Conversion has finished");
|
||||
PlotMain.sendConsoleSenderMessage("&cAlthough the server may be functional in it's current state, it is recommended that you restart the server and remove PlotMe to finalize the installation. Please make careful note of any warning messages that may have showed up during conversion.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user