From dbf30740fb95fdacc2d3f21faa2b1c54e2e28777 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Thu, 2 Feb 2012 02:01:04 +0000 Subject: Fix a bug with getWorldData return the main world data for all mirrors, instead of the worlds parent data. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../src/org/anjocaido/groupmanager/GroupManager.java | 2 +- .../groupmanager/dataholder/worlds/WorldsHolder.java | 13 ++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 490df8fc6..e48365de5 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -133,4 +133,5 @@ v 1.9: - -vanish.* - vanish.standard - Track the 'onPlayerChangeWorld' event as some teleports seem to not be triggering a world move. - - Catch all errors in badly formatted groups. \ No newline at end of file + - Catch all errors in badly formatted groups. + - Fix a bug with getWorldData return the main world data for all mirrors, instead of the worlds parent data. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index 43b764faf..bb61b2145 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -1762,9 +1762,9 @@ public class GroupManager extends JavaPlugin { dataHolder = worldsHolder.getWorldData(worldsHolder.getDefaultWorld().getName()); permissionHandler = dataHolder.getPermissionsHandler(); - selectedWorlds.put(sender, dataHolder.getName()); if ((dataHolder != null) && (permissionHandler != null)) { + selectedWorlds.put(sender, dataHolder.getName()); sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. Default world '" + worldsHolder.getDefaultWorld().getName() + "' selected."); return true; } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java index 686a5495d..6d819daa5 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java @@ -320,7 +320,8 @@ public class WorldsHolder { * If the world is not on the worlds list, returns the default world * holder. * - * Mirrors return original world data. + * Mirrors return their parent world data. + * If no mirroring data it returns the default world. * * @param worldName * @return OverloadedWorldHolder @@ -328,8 +329,17 @@ public class WorldsHolder { public OverloadedWorldHolder getWorldData(String worldName) { String worldNameLowered = worldName.toLowerCase(); + // Return this worlds data if (worldsData.containsKey(worldNameLowered)) return worldsData.get(worldNameLowered); + + // If groups mirrored return the parent worlds data + if (mirrorsGroup.containsKey(worldNameLowered)) + return worldsData.get(mirrorsGroup.get(worldNameLowered).toLowerCase()); + + // If users mirrored return the parent worlds data + if (mirrorsUser.containsKey(worldNameLowered)) + return worldsData.get(mirrorsUser.get(worldNameLowered).toLowerCase()); GroupManager.logger.finest("Requested world " + worldName + " not found or badly mirrored. Returning default world..."); return getDefaultWorld(); @@ -353,6 +363,7 @@ public class WorldsHolder { /** * Retrieves the field player.getWorld().getName() and do * getWorld(worldName) + * * @param player * @return OverloadedWorldHolder */ -- cgit v1.2.3