mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-09-12 05:08:48 +00:00
Fix mirroring now we are not using any Bukkit methods.
This commit is contained in:
parent
7b482b612e
commit
73fb2d3735
|
@ -22,7 +22,6 @@ import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder;
|
||||||
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
||||||
import org.anjocaido.groupmanager.utils.Tasks;
|
import org.anjocaido.groupmanager.utils.Tasks;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.configuration.MemorySection;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,9 +96,13 @@ public class WorldsHolder {
|
||||||
* Create the data files if they don't already exist,
|
* Create the data files if they don't already exist,
|
||||||
* and they are not mirrored.
|
* and they are not mirrored.
|
||||||
*/
|
*/
|
||||||
for (World world : plugin.getServer().getWorlds())
|
for (World world : plugin.getServer().getWorlds()){
|
||||||
if ((!worldsData.containsKey(world.getName().toLowerCase())) && ((!mirrorsGroup.containsKey(world.getName().toLowerCase())) || (!mirrorsUser.containsKey(world.getName().toLowerCase()))))
|
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());
|
setupWorldFolder(world.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Loop over all folders within the worlds folder
|
* Loop over all folders within the worlds folder
|
||||||
* and attempt to load the world data
|
* and attempt to load the world data
|
||||||
|
@ -164,12 +167,12 @@ public class WorldsHolder {
|
||||||
} else
|
} else
|
||||||
GroupManager.logger.log(Level.WARNING, "Mirroring error with " + o.toString() + ". Recursive loop detected!");
|
GroupManager.logger.log(Level.WARNING, "Mirroring error with " + o.toString() + ". Recursive loop detected!");
|
||||||
}
|
}
|
||||||
} else if (mirrorsMap.get(source) instanceof MemorySection) {
|
} else if (mirrorsMap.get(source) instanceof Map) {
|
||||||
MemorySection subSection = (MemorySection) mirrorsMap.get(source);
|
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) {
|
if (subSection.get(key) instanceof ArrayList) {
|
||||||
ArrayList mirrorList = (ArrayList) subSection.get(key);
|
ArrayList mirrorList = (ArrayList) subSection.get(key);
|
||||||
|
@ -179,28 +182,32 @@ public class WorldsHolder {
|
||||||
String type = o.toString().toLowerCase();
|
String type = o.toString().toLowerCase();
|
||||||
try {
|
try {
|
||||||
if (type.equals("groups"))
|
if (type.equals("groups"))
|
||||||
mirrorsGroup.remove(key.toLowerCase());
|
mirrorsGroup.remove(((String)key).toLowerCase());
|
||||||
|
|
||||||
if (type.equals("users"))
|
if (type.equals("users"))
|
||||||
mirrorsUser.remove(key.toLowerCase());
|
mirrorsUser.remove(((String)key).toLowerCase());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
if (type.equals("groups"))
|
if (type.equals("groups")) {
|
||||||
mirrorsGroup.put(key.toLowerCase(), getWorldData(source).getName());
|
mirrorsGroup.put(((String)key).toLowerCase(), getWorldData(source).getName());
|
||||||
|
GroupManager.logger.log(Level.FINE, "Adding groups mirror for " + key + ".");
|
||||||
|
}
|
||||||
|
|
||||||
if (type.equals("users"))
|
if (type.equals("users")) {
|
||||||
mirrorsUser.put(key.toLowerCase(), getWorldData(source).getName());
|
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
|
// Track this world so we can create a datasource for it later
|
||||||
mirroredWorlds.add(key);
|
mirroredWorlds.add((String)key);
|
||||||
|
|
||||||
} else
|
} 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 {
|
} 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
|
// Create a datasource for any worlds not already loaded
|
||||||
for (String world : mirroredWorlds) {
|
for (String world : mirroredWorlds) {
|
||||||
if (!worldsData.containsKey(world.toLowerCase())) {
|
if (!worldsData.containsKey(world.toLowerCase())) {
|
||||||
|
GroupManager.logger.log(Level.FINE, "No data for " + world + ".");
|
||||||
setupWorldFolder(world);
|
setupWorldFolder(world);
|
||||||
loadWorld(world, true);
|
loadWorld(world, true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue