mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-10 18:38:18 +01:00
Fix recursive loop when used on offline servers.
This commit is contained in:
parent
4533d09fc9
commit
04c833f648
@ -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
|
* Check user and groups with inheritance and Bukkit if bukkit = true return
|
||||||
* a PermissionCheckResult.
|
* a PermissionCheckResult.
|
||||||
*
|
*
|
||||||
@ -778,22 +781,41 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
|||||||
*/
|
*/
|
||||||
public PermissionCheckResult checkFullGMPermission(User user, String targetPermission, Boolean checkBukkit) {
|
public PermissionCheckResult checkFullGMPermission(User user, String targetPermission, Boolean checkBukkit) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Report no permissions under the following conditions.
|
||||||
|
*
|
||||||
|
* We are in offline mode
|
||||||
|
* and the player has the 'groupmanager.noofflineperms' permission.
|
||||||
|
*/
|
||||||
|
if (user == null || targetPermission == null || targetPermission.isEmpty() ||
|
||||||
|
(!Bukkit.getServer().getOnlineMode()
|
||||||
|
&& (checkPermission(user, "groupmanager.noofflineperms", true).resultType == PermissionCheckResult.Type.FOUND))) {
|
||||||
|
|
||||||
PermissionCheckResult result = new PermissionCheckResult();
|
PermissionCheckResult result = new PermissionCheckResult();
|
||||||
result.accessLevel = targetPermission;
|
result.accessLevel = targetPermission;
|
||||||
result.resultType = PermissionCheckResult.Type.NOTFOUND;
|
result.resultType = PermissionCheckResult.Type.NOTFOUND;
|
||||||
|
|
||||||
if (user == null || targetPermission == null || targetPermission.isEmpty()) {
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
return checkPermission(user, targetPermission, checkBukkit);
|
||||||
* Do not push any perms to bukkit if...
|
}
|
||||||
* We are in offline mode
|
|
||||||
* and the player has the 'groupmanager.noofflineperms' permission.
|
/**
|
||||||
|
*
|
||||||
|
* Check user and groups with inheritance and Bukkit if bukkit = true return
|
||||||
|
* a PermissionCheckResult.
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* @param targetPermission
|
||||||
|
* @param checkBukkit
|
||||||
|
* @return PermissionCheckResult
|
||||||
*/
|
*/
|
||||||
if (!Bukkit.getServer().getOnlineMode()
|
private PermissionCheckResult checkPermission(User user, String targetPermission, Boolean checkBukkit) {
|
||||||
&& (checkFullGMPermission(user, "groupmanager.noofflineperms", true).resultType == PermissionCheckResult.Type.FOUND))
|
|
||||||
return result;
|
PermissionCheckResult result = new PermissionCheckResult();
|
||||||
|
result.accessLevel = targetPermission;
|
||||||
|
result.resultType = PermissionCheckResult.Type.NOTFOUND;
|
||||||
|
|
||||||
if (checkBukkit) {
|
if (checkBukkit) {
|
||||||
// Check Bukkit perms to support plugins which add perms via code
|
// Check Bukkit perms to support plugins which add perms via code
|
||||||
|
Loading…
Reference in New Issue
Block a user