diff options
author | ElgarL <ElgarL@palmergames.com> | 2011-10-31 20:20:57 +0000 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2011-10-31 20:20:57 +0000 |
commit | 1fd02b8a4ad82427f96e1870252a31375d58c2f5 (patch) | |
tree | 3d56d86dcf925f72ca5881e3e94405848762af21 /EssentialsGroupManager/src/org | |
parent | 9734274ed1b61ba50272324a2bd72723e6b576be (diff) | |
download | Essentials-1fd02b8a4ad82427f96e1870252a31375d58c2f5.tar Essentials-1fd02b8a4ad82427f96e1870252a31375d58c2f5.tar.gz Essentials-1fd02b8a4ad82427f96e1870252a31375d58c2f5.tar.lz Essentials-1fd02b8a4ad82427f96e1870252a31375d58c2f5.tar.xz Essentials-1fd02b8a4ad82427f96e1870252a31375d58c2f5.zip |
Expanded 'canUserBuild()' to include inheritance and subgroups.
Diffstat (limited to 'EssentialsGroupManager/src/org')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java | 1 | ||||
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java | 51 |
2 files changed, 28 insertions, 24 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index ebb63653a..e3999d212 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -1183,6 +1183,7 @@ public class GroupManager extends JavaPlugin { if (!auxUser.isSubGroupsEmpty() && auxGroup2 == null) for (Group subGroup : auxUser.subGroupListCopy()) { auxGroup2 = permissionHandler.nextGroupWithVariable(subGroup, args[1]); + if (auxGroup2 != null) continue; } if (auxGroup2 == null) { sender.sendMessage(ChatColor.RED + "The user doesn't have access to that variable!"); diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index e7939c411..e7ece0575 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -225,7 +225,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } /** - * Check if user can build. + * Check if user can build. Checks inheritance and subgroups. * * @param world * Player's world @@ -233,14 +233,9 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * Player's name * @return Whether the user can build */ - public boolean canUserBuild(String user) { - boolean test = ph.getUser(user).getVariables().getVarBoolean("build"); + public boolean canUserBuild(String userName) { - if (test) { - return test; - } - - return canGroupBuild(getGroup(user)); + return getPermissionBoolean(userName, "build"); } @@ -438,8 +433,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { /** * Returns the variable value of the user, in INFO node. If not found, it - * will search for his Group variables. It will harvest the inheritance - * and subgroups. + * will search for his Group variables. It will harvest the inheritance and + * subgroups. * * @param user * @param variable @@ -465,9 +460,11 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { for (Group subGroup : auser.subGroupListCopy()) { result = nextGroupWithVariable(subGroup, variable); // Found value? - if (result != null) continue; + if (result != null) + continue; } - if (result == null) return ""; + if (result == null) + return ""; } return result.getVariables().getVarString(variable); // return getUserPermissionString(user, variable); @@ -475,8 +472,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { /** * Returns the variable value of the user, in INFO node. If not found, it - * will search for his Group variables. It will harvest the inheritance - * and subgroups. + * will search for his Group variables. It will harvest the inheritance and + * subgroups. * * @param user * @param variable @@ -502,9 +499,11 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { for (Group subGroup : auser.subGroupListCopy()) { result = nextGroupWithVariable(subGroup, variable); // Found value? - if (result != null) continue; + if (result != null) + continue; } - if (result == null) return -1; + if (result == null) + return -1; } return result.getVariables().getVarInteger(variable); // return getUserPermissionInteger(string, string1); @@ -512,8 +511,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { /** * Returns the variable value of the user, in INFO node. If not found, it - * will search for his Group variables. It will harvest the inheritance - * and subgroups. + * will search for his Group variables. It will harvest the inheritance and + * subgroups. * * @param user * @param variable @@ -539,9 +538,11 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { for (Group subGroup : auser.subGroupListCopy()) { result = nextGroupWithVariable(subGroup, variable); // Found value? - if (result != null) continue; + if (result != null) + continue; } - if (result == null) return false; + if (result == null) + return false; } return result.getVariables().getVarBoolean(variable); // return getUserPermissionBoolean(user, string1); @@ -549,8 +550,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { /** * Returns the variable value of the user, in INFO node. If not found, it - * will search for his Group variables. It will harvest the inheritance - * and subgroups. + * will search for his Group variables. It will harvest the inheritance and + * subgroups. * * @param user * @param variable @@ -576,9 +577,11 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { for (Group subGroup : auser.subGroupListCopy()) { result = nextGroupWithVariable(subGroup, variable); // Found value? - if (result != null) continue; + if (result != null) + continue; } - if (result == null) return -1.0D; + if (result == null) + return -1.0D; } return result.getVariables().getVarDouble(variable); // return getUserPermissionDouble(string, string1); |