From 9173aa6814ab4097c5cf644f3177b8332dd8d36b Mon Sep 17 00:00:00 2001 From: KHobbits Date: Wed, 8 Feb 2012 20:10:19 +0000 Subject: [PATCH] GroupManager Modifications Look up the right group name in inGroup Since world is a required param in GM, lets catch some nulls Use a little intelligence when promoting users. --- .../plugins/Permission_GroupManager.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_GroupManager.java b/src/net/milkbowl/vault/permission/plugins/Permission_GroupManager.java index 898aa0a..e1f365b 100644 --- a/src/net/milkbowl/vault/permission/plugins/Permission_GroupManager.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_GroupManager.java @@ -188,12 +188,18 @@ public class Permission_GroupManager extends Permission { @Override public boolean playerInGroup(String worldName, String playerName, String groupName) { - return perms.inGroup(playerName, worldName); + return perms.inGroup(playerName, groupName); } @Override 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) { return false; } @@ -207,6 +213,8 @@ public class Permission_GroupManager extends Permission { } if (user.getGroup().equals(owh.getDefaultGroup())) { user.setGroup(group); + } else if (group.getInherits().contains(user.getGroup().getName().toLowerCase())) { + user.setGroup(group); } else { user.addSubGroup(group); } @@ -215,7 +223,13 @@ public class Permission_GroupManager extends Permission { @Override 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) { return false; }