Fix a bug with getWorldData return the main world data for all mirrors,

instead of the worlds parent data.
This commit is contained in:
ElgarL 2012-02-02 02:01:04 +00:00
parent 3f02bcd702
commit dbf30740fb
3 changed files with 15 additions and 3 deletions

View file

@ -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.
- 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.

View file

@ -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;
}

View file

@ -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
*/