summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2012-08-03 11:15:14 +0100
committerElgarL <ElgarL@palmergames.com>2012-08-03 11:15:14 +0100
commit73fb2d3735e6c4db4ca2e7bd61b163ad359ce25f (patch)
tree6be52a463fff68f84ecaa09a87ba182f4e09c6c7
parent7b482b612e42a24bd2602a2c1a3dba15c146bc83 (diff)
downloadEssentials-73fb2d3735e6c4db4ca2e7bd61b163ad359ce25f.tar
Essentials-73fb2d3735e6c4db4ca2e7bd61b163ad359ce25f.tar.gz
Essentials-73fb2d3735e6c4db4ca2e7bd61b163ad359ce25f.tar.lz
Essentials-73fb2d3735e6c4db4ca2e7bd61b163ad359ce25f.tar.xz
Essentials-73fb2d3735e6c4db4ca2e7bd61b163ad359ce25f.zip
Fix mirroring now we are not using any Bukkit methods.
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java40
1 files changed, 24 insertions, 16 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
index afdb0e15b..f84262eeb 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
@@ -22,7 +22,6 @@ 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.configuration.MemorySection;
import org.bukkit.entity.Player;
/**
@@ -97,9 +96,13 @@ public class WorldsHolder {
* 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())) && ((!mirrorsGroup.containsKey(world.getName().toLowerCase())) || (!mirrorsUser.containsKey(world.getName().toLowerCase()))))
+ for (World world : plugin.getServer().getWorlds()){
+ GroupManager.logger.log(Level.FINE, "Checking data for " + world.getName() + ".");
+ if ((!worldsData.containsKey(world.getName().toLowerCase())) && ((!mirrorsGroup.containsKey(world.getName().toLowerCase())) || (!mirrorsUser.containsKey(world.getName().toLowerCase())))) {
+ GroupManager.logger.log(Level.FINE, "Creating folders for " + world.getName() + ".");
setupWorldFolder(world.getName());
+ }
+ }
/*
* Loop over all folders within the worlds folder
* and attempt to load the world data
@@ -164,12 +167,12 @@ public class WorldsHolder {
} else
GroupManager.logger.log(Level.WARNING, "Mirroring error with " + o.toString() + ". Recursive loop detected!");
}
- } else if (mirrorsMap.get(source) instanceof MemorySection) {
- MemorySection subSection = (MemorySection) mirrorsMap.get(source);
+ } else if (mirrorsMap.get(source) instanceof Map) {
+ Map subSection = (Map) mirrorsMap.get(source);
- for (String key : subSection.getKeys(true)) {
+ for (Object key : subSection.keySet()) {
- if (key.toLowerCase() != serverDefaultWorldName) {
+ if (((String)key).toLowerCase() != serverDefaultWorldName) {
if (subSection.get(key) instanceof ArrayList) {
ArrayList mirrorList = (ArrayList) subSection.get(key);
@@ -179,28 +182,32 @@ public class WorldsHolder {
String type = o.toString().toLowerCase();
try {
if (type.equals("groups"))
- mirrorsGroup.remove(key.toLowerCase());
+ mirrorsGroup.remove(((String)key).toLowerCase());
if (type.equals("users"))
- mirrorsUser.remove(key.toLowerCase());
+ mirrorsUser.remove(((String)key).toLowerCase());
} catch (Exception e) {
}
- if (type.equals("groups"))
- mirrorsGroup.put(key.toLowerCase(), getWorldData(source).getName());
+ if (type.equals("groups")) {
+ mirrorsGroup.put(((String)key).toLowerCase(), getWorldData(source).getName());
+ GroupManager.logger.log(Level.FINE, "Adding groups mirror for " + key + ".");
+ }
- if (type.equals("users"))
- mirrorsUser.put(key.toLowerCase(), getWorldData(source).getName());
+ if (type.equals("users")) {
+ mirrorsUser.put(((String)key).toLowerCase(), getWorldData(source).getName());
+ GroupManager.logger.log(Level.FINE, "Adding users mirror for " + key + ".");
+ }
}
// Track this world so we can create a datasource for it later
- mirroredWorlds.add(key);
+ mirroredWorlds.add((String)key);
} else
- GroupManager.logger.log(Level.WARNING, "Mirroring error with " + key + ". Recursive loop detected!");
+ GroupManager.logger.log(Level.WARNING, "Mirroring error with " + (String)key + ". Recursive loop detected!");
} else {
- throw new IllegalStateException("Unknown mirroring format for " + key);
+ throw new IllegalStateException("Unknown mirroring format for " + (String)key);
}
}
@@ -210,6 +217,7 @@ public class WorldsHolder {
// Create a datasource for any worlds not already loaded
for (String world : mirroredWorlds) {
if (!worldsData.containsKey(world.toLowerCase())) {
+ GroupManager.logger.log(Level.FINE, "No data for " + world + ".");
setupWorldFolder(world);
loadWorld(world, true);
}