Optimize fetching of Mirrored world data.

This commit is contained in:
ElgarL 2012-01-10 18:40:34 +00:00
parent 58057a771d
commit 2a478fe03d
3 changed files with 14 additions and 11 deletions

View File

@ -97,4 +97,5 @@ v 1.8:
- Reload GlobalGroups when you perform a world load.
- Changed GlobalGroups to save/load before local groups in the scheduled data saving/loading
- Fix 'manucheckp' to correctly report if a permission is available from GroupManager or Bukkit.
- Changed over to a reflection method for populating superperms as Bukkit lags when you handle permissions one at a time.
- Changed over to a reflection method for populating superperms as Bukkit lags when you handle permissions one at a time.
- Optimize fetching of Mirrored world data.

View File

@ -25,14 +25,14 @@ settings:
level: INFO
mirrors:
# Worlds listed here have their permissions mirrored in their children.
# Worlds listed here have their settings mirrored in their children.
# the first element 'world' is the main worlds name
# subsequent elements '- world_nether' are worlds which will use the same
# user/groups permissions as the parent.
# subsequent elements 'world_nether' and 'world_the_end' are worlds which will use the same
# user/groups files as the parent.
world:
- world_nether
- world_the_end
- world2
- world3
# - world2
# - world3
# world4:
# - world5

View File

@ -270,11 +270,12 @@ public class WorldsHolder {
*/
public OverloadedWorldHolder getWorldData(String worldName) {
String worldNameLowered = worldName.toLowerCase();
OverloadedWorldHolder data = worldsData.get(worldNameLowered);
// If a mirror change to the real world to load.
if (mirrors.containsKey(worldNameLowered)) {
String realOne = mirrors.get(worldNameLowered);
data = worldsData.get(realOne.toLowerCase());
}
worldNameLowered = mirrors.get(worldNameLowered);
}
OverloadedWorldHolder data = worldsData.get(worldNameLowered);
if (data == null) {
GroupManager.logger.finest("Requested world " + worldName + " not found or badly mirrored. Returning default world...");
data = getDefaultWorld();
@ -283,8 +284,9 @@ public class WorldsHolder {
}
/**
* Do a matching of playerName, if it s found only one player, do
* Do a matching of playerName, if its found only one player, do
* getWorldData(player)
*
* @param playerName
* @return null if matching returned no player, or more than one.
*/