diff options
-rw-r--r-- | EssentialsGroupManager/src/Changelog.txt | 4 | ||||
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java | 33 |
2 files changed, 29 insertions, 8 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 5523f524e..bae06f1de 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -32,4 +32,6 @@ v 1.2: - GM will now create all relevant world data files for non mirrored worlds.
(for all worlds named in config.yml)
- Attempt to stop GM wiping groups/users yml's on a bad shut down.
- - Added event handling to manage new world creation at runtime.
\ No newline at end of file + - Added event handling to manage new world creation at runtime.
+ - Added the ability to handle unknown worlds at server start.
+ (GM will create the data files for any worlds it finds which are not in the config.yml)
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java index a5e76e464..50e6ef547 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java @@ -21,6 +21,7 @@ import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder; import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler; import org.anjocaido.groupmanager.utils.Tasks; +import org.bukkit.World; import org.bukkit.entity.Player; /** @@ -70,21 +71,39 @@ public class WorldsHolder { } private void initialWorldLoading() { - //LOAD EVERY WORLD POSSIBLE + //Load the default world loadWorld(serverDefaultWorldName); defaultWorld = worldsData.get(serverDefaultWorldName); } private void loadAllSearchedWorlds() { + + /* + * Read all known worlds from Bukkit + * Create the data files if they don't already exist, + * and they are not mirrored. + */ + for (World world: plugin.getServer().getWorlds()) + if ((!worldsData.containsKey(world.getName().toLowerCase())) + && (!mirrors.containsKey(world.getName().toLowerCase()))) + setupWorldFolder(world.getName()); + /* + * Loop over all folders within the worlds folder + * and attempt to load the world data + */ for (File folder : worldsFolder.listFiles()) { - if (folder.isDirectory()) + if (folder.isDirectory()) { GroupManager.logger.info("World Found: " + folder.getName()); - if (worldsData.containsKey(folder.getName().toLowerCase())) { - continue; - } - if (folder.isDirectory()) { - loadWorld(folder.getName()); + /* + * don't load any worlds which are already loaded + * or mirrored worlds that don't need data. + */ + if (worldsData.containsKey(folder.getName().toLowerCase()) + || mirrors.containsKey(folder.getName().toLowerCase())) { + continue; + } + loadWorld(folder.getName()); } } } |