We shouldn't try to load deleted worlds

This commit is contained in:
main() 2012-08-06 11:29:54 +02:00
parent e197091bb2
commit 3395f3d7c7

View File

@ -116,6 +116,7 @@ public class WorldManager implements MVWorldManager {
this.plugin.log(Level.INFO, builder.toString()); this.plugin.log(Level.INFO, builder.toString());
try { try {
Thread t = new Thread(new Runnable() { Thread t = new Thread(new Runnable() {
@Override
public void run() { public void run() {
FileUtils.copyFolder(oldWorldFile, newWorldFile, Logger.getLogger("Minecraft")); FileUtils.copyFolder(oldWorldFile, newWorldFile, Logger.getLogger("Minecraft"));
} }
@ -322,6 +323,8 @@ public class WorldManager implements MVWorldManager {
this.plugin.log(Level.WARNING, "Hmm Multiverse does not know about this world but it's loaded in memory."); this.plugin.log(Level.WARNING, "Hmm Multiverse does not know about this world but it's loaded in memory.");
this.plugin.log(Level.WARNING, "To let Multiverse know about it, use:"); this.plugin.log(Level.WARNING, "To let Multiverse know about it, use:");
this.plugin.log(Level.WARNING, String.format("/mv import %s %s", name, this.plugin.getServer().getWorld(name).getEnvironment().toString())); this.plugin.log(Level.WARNING, String.format("/mv import %s %s", name, this.plugin.getServer().getWorld(name).getEnvironment().toString()));
} else if (this.worldsFromTheConfig.containsKey(name)) {
return true; // it's already unloaded
} else { } else {
this.plugin.log(Level.INFO, "Multiverse does not know about " + name + " and it's not loaded by Bukkit."); this.plugin.log(Level.INFO, "Multiverse does not know about " + name + " and it's not loaded by Bukkit.");
} }
@ -377,6 +380,13 @@ public class WorldManager implements MVWorldManager {
if (worlds.containsKey(worldName)) if (worlds.containsKey(worldName))
throw new IllegalArgumentException("That world is already loaded!"); throw new IllegalArgumentException("That world is already loaded!");
} }
if (!new File(this.plugin.getServer().getWorldContainer(), worldName).exists()) {
this.plugin.log(Level.WARNING, "WorldManager: Can't load this world because the folder was deleted/moved: " + worldName);
this.plugin.log(Level.WARNING, "Use '/mv remove' to remove it from the config!");
return false;
}
MVWorld mvworld = worldsFromTheConfig.get(worldName); MVWorld mvworld = worldsFromTheConfig.get(worldName);
World cbworld; World cbworld;
try { try {