fix NPE when the worldhandler doesn't exist for group checking.

Thanks Siguza
This commit is contained in:
Sleaker 2012-04-25 16:52:06 -07:00
parent 7f905ca57a
commit 6a04b59866

View File

@ -299,6 +299,9 @@ public class Permission_GroupManager extends Permission {
} else { } else {
handler = groupManager.getWorldsHolder().getWorldPermissions(worldName); handler = groupManager.getWorldsHolder().getWorldPermissions(worldName);
} }
if (handler == null) {
return null;
}
return handler.getGroups(playerName); return handler.getGroups(playerName);
} }
@ -310,6 +313,9 @@ public class Permission_GroupManager extends Permission {
} else { } else {
handler = groupManager.getWorldsHolder().getWorldPermissions(worldName); handler = groupManager.getWorldsHolder().getWorldPermissions(worldName);
} }
if (handler == null) {
return null;
}
return handler.getGroup(playerName); return handler.getGroup(playerName);
} }
@ -357,7 +363,14 @@ public class Permission_GroupManager extends Permission {
public String[] getGroups() { public String[] getGroups() {
Set<String> groupNames = new HashSet<String>(); Set<String> groupNames = new HashSet<String>();
for (World world : Bukkit.getServer().getWorlds()) { for (World world : Bukkit.getServer().getWorlds()) {
Collection<Group> groups = groupManager.getWorldsHolder().getWorldData(world.getName()).getGroupList(); OverloadedWorldHolder owh = groupManager.getWorldsHolder().getWorldData(world.getName());
if (owh == null) {
continue;
}
Collection<Group> groups = owh.getGroupList();
if (groups == null) {
continue;
}
for (Group group : groups) { for (Group group : groups) {
groupNames.add(group.getName()); groupNames.add(group.getName());
} }