summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager
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
commite5c02b34817f8ad263d365edc2818454a0966065 (patch)
tree3d3a9eca33abf28282c72a1ebe37e784f5c7900c /EssentialsGroupManager
parent9d4e553cf84040e127746036bc71252eaeb230f7 (diff)
downloadEssentials-e5c02b34817f8ad263d365edc2818454a0966065.tar
Essentials-e5c02b34817f8ad263d365edc2818454a0966065.tar.gz
Essentials-e5c02b34817f8ad263d365edc2818454a0966065.tar.lz
Essentials-e5c02b34817f8ad263d365edc2818454a0966065.tar.xz
Essentials-e5c02b34817f8ad263d365edc2818454a0966065.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')
-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());
}
}
}