mirror of
https://github.com/essentials/Essentials.git
synced 2025-02-24 00:13:48 +01:00
Fix mirroring now we are not using any Bukkit methods.
This commit is contained in:
parent
9924703426
commit
0b0c3f99e9
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user