Merge pull request #92 from khobbits/master

GM behaviour changes.
This commit is contained in:
Nick Minkler 2012-02-08 13:00:03 -08:00
commit 532bee2930

View File

@ -188,12 +188,18 @@ public class Permission_GroupManager extends Permission {
@Override @Override
public boolean playerInGroup(String worldName, String playerName, String groupName) { public boolean playerInGroup(String worldName, String playerName, String groupName) {
return perms.inGroup(playerName, worldName); return perms.inGroup(playerName, groupName);
} }
@Override @Override
public boolean playerAddGroup(String worldName, String playerName, String groupName) { public boolean playerAddGroup(String worldName, String playerName, String groupName) {
OverloadedWorldHolder owh = groupManager.getWorldsHolder().getWorldData(worldName); OverloadedWorldHolder owh;
if (worldName == null) {
owh = groupManager.getWorldsHolder().getWorldDataByPlayerName(playerName);
}
else {
owh = groupManager.getWorldsHolder().getWorldData(worldName);
}
if (owh == null) { if (owh == null) {
return false; return false;
} }
@ -207,6 +213,8 @@ public class Permission_GroupManager extends Permission {
} }
if (user.getGroup().equals(owh.getDefaultGroup())) { if (user.getGroup().equals(owh.getDefaultGroup())) {
user.setGroup(group); user.setGroup(group);
} else if (group.getInherits().contains(user.getGroup().getName().toLowerCase())) {
user.setGroup(group);
} else { } else {
user.addSubGroup(group); user.addSubGroup(group);
} }
@ -215,7 +223,13 @@ public class Permission_GroupManager extends Permission {
@Override @Override
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) { public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
OverloadedWorldHolder owh = groupManager.getWorldsHolder().getWorldData(worldName); OverloadedWorldHolder owh;
if (worldName == null) {
owh = groupManager.getWorldsHolder().getWorldDataByPlayerName(playerName);
}
else {
owh = groupManager.getWorldsHolder().getWorldData(worldName);
}
if (owh == null) { if (owh == null) {
return false; return false;
} }