mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-06 02:39:48 +01:00
Merge pull request #2379 from rti/master
load cloned world with doLoad() instead of addWorld() (fixes #2378)
This commit is contained in:
commit
ad1b733498
@ -189,16 +189,31 @@ public class WorldManager implements MVWorldManager {
|
|||||||
|
|
||||||
if (newWorldFile.exists()) {
|
if (newWorldFile.exists()) {
|
||||||
Logging.fine("Succeeded at copying files");
|
Logging.fine("Succeeded at copying files");
|
||||||
if (this.addWorld(newName, environment, seedString, worldType, generateStructures, generator, useSpawnAdjust)) {
|
|
||||||
// getMVWorld() doesn't actually return an MVWorld
|
// initialize new properties with old ones
|
||||||
Logging.fine("Succeeded at importing world");
|
WorldProperties newProps = new WorldProperties();
|
||||||
MVWorld newWorld = (MVWorld) this.getMVWorld(newName);
|
newProps.copyValues(this.worldsFromTheConfig.get(oldName));
|
||||||
newWorld.copyValues(this.worldsFromTheConfig.get(oldName));
|
// don't keep the alias the same -- that would be useless
|
||||||
// don't keep the alias the same -- that would be useless
|
newProps.setAlias("");
|
||||||
newWorld.setAlias("");
|
// store the new properties in worlds config map
|
||||||
return true;
|
this.worldsFromTheConfig.put(newName, newProps);
|
||||||
|
|
||||||
|
// save the worlds config to disk (worlds.yml)
|
||||||
|
if (!saveWorldsConfig()) {
|
||||||
|
this.plugin.log(Level.SEVERE, "Failed to save worlds.yml");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// actually load the world
|
||||||
|
if (doLoad(newName)) {
|
||||||
|
this.plugin.log(Level.FINE, "Succeeded at loading cloned world '" + newName + "'");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.plugin.log(Level.SEVERE, "Failed to load the cloned world '" + newName + "'");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logging.warning("Failed to copy files for world '%s', see the log info", newName);
|
Logging.warning("Failed to copy files for world '%s', see the log info", newName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user