summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src/org/anjocaido
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2013-01-14 06:47:50 +0000
committerElgarL <ElgarL@palmergames.com>2013-01-14 06:47:50 +0000
commit5f5bb2ed8a1bdad5c55b8df60fdbe331720d9954 (patch)
tree86f53aac38d3c320c83c67aa9facb678b5bc6031 /EssentialsGroupManager/src/org/anjocaido
parent9c36a03028caac4d0b9d8fd7efa7344f8042a01c (diff)
downloadEssentials-5f5bb2ed8a1bdad5c55b8df60fdbe331720d9954.tar
Essentials-5f5bb2ed8a1bdad5c55b8df60fdbe331720d9954.tar.gz
Essentials-5f5bb2ed8a1bdad5c55b8df60fdbe331720d9954.tar.lz
Essentials-5f5bb2ed8a1bdad5c55b8df60fdbe331720d9954.tar.xz
Essentials-5f5bb2ed8a1bdad5c55b8df60fdbe331720d9954.zip
Fix recursive loop when used on offline servers.
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido')
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java44
1 files changed, 33 insertions, 11 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
index 59efb33dc..7396f3f70 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
@@ -768,6 +768,9 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
+ * Wrapper for offline server checks.
+ * Looks for the 'groupmanager.noofflineperms' permissions and reports no permissions on servers set to offline.
+ *
* Check user and groups with inheritance and Bukkit if bukkit = true return
* a PermissionCheckResult.
*
@@ -778,23 +781,42 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
*/
public PermissionCheckResult checkFullGMPermission(User user, String targetPermission, Boolean checkBukkit) {
- PermissionCheckResult result = new PermissionCheckResult();
- result.accessLevel = targetPermission;
- result.resultType = PermissionCheckResult.Type.NOTFOUND;
-
- if (user == null || targetPermission == null || targetPermission.isEmpty()) {
- return result;
- }
-
/*
- * Do not push any perms to bukkit if...
+ * Report no permissions under the following conditions.
+ *
* We are in offline mode
* and the player has the 'groupmanager.noofflineperms' permission.
*/
- if (!Bukkit.getServer().getOnlineMode()
- && (checkFullGMPermission(user, "groupmanager.noofflineperms", true).resultType == PermissionCheckResult.Type.FOUND))
+ if (user == null || targetPermission == null || targetPermission.isEmpty() ||
+ (!Bukkit.getServer().getOnlineMode()
+ && (checkPermission(user, "groupmanager.noofflineperms", true).resultType == PermissionCheckResult.Type.FOUND))) {
+
+ PermissionCheckResult result = new PermissionCheckResult();
+ result.accessLevel = targetPermission;
+ result.resultType = PermissionCheckResult.Type.NOTFOUND;
+
return result;
+ }
+
+ return checkPermission(user, targetPermission, checkBukkit);
+ }
+
+ /**
+ *
+ * Check user and groups with inheritance and Bukkit if bukkit = true return
+ * a PermissionCheckResult.
+ *
+ * @param user
+ * @param targetPermission
+ * @param checkBukkit
+ * @return PermissionCheckResult
+ */
+ private PermissionCheckResult checkPermission(User user, String targetPermission, Boolean checkBukkit) {
+ PermissionCheckResult result = new PermissionCheckResult();
+ result.accessLevel = targetPermission;
+ result.resultType = PermissionCheckResult.Type.NOTFOUND;
+
if (checkBukkit) {
// Check Bukkit perms to support plugins which add perms via code
// (Heroes).