summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2011-10-01 21:07:39 +0100
committerElgarL <ElgarL@palmergames.com>2011-10-01 21:07:39 +0100
commit3030093907930543521d27e6f8e814251bc08b59 (patch)
tree07da7ad83b3955b1994ee7642b0492928805ffa3 /EssentialsGroupManager/src
parent0e867df1950ae9e056dc9a95ffd73c97bb56e2e5 (diff)
downloadEssentials-3030093907930543521d27e6f8e814251bc08b59.tar
Essentials-3030093907930543521d27e6f8e814251bc08b59.tar.gz
Essentials-3030093907930543521d27e6f8e814251bc08b59.tar.lz
Essentials-3030093907930543521d27e6f8e814251bc08b59.tar.xz
Essentials-3030093907930543521d27e6f8e814251bc08b59.zip
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)
Diffstat (limited to 'EssentialsGroupManager/src')
-rw-r--r--EssentialsGroupManager/src/Changelog.txt4
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java33
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());
}
}
}