mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-15 11:51:55 +01:00
Refactor to reduce complexity.
This commit is contained in:
parent
f9e57898ab
commit
3331ffac4e
@ -340,8 +340,6 @@ public class User implements MetaDataAble {
|
|||||||
// If requester is console, then return the default value
|
// If requester is console, then return the default value
|
||||||
if (!isPlayer()) return defaultValue;
|
if (!isPlayer()) return defaultValue;
|
||||||
|
|
||||||
int value = 0;
|
|
||||||
|
|
||||||
// If there is a dot at the end of the permissionPrefix, remove it
|
// If there is a dot at the end of the permissionPrefix, remove it
|
||||||
if (permissionPrefix.endsWith(".")) {
|
if (permissionPrefix.endsWith(".")) {
|
||||||
permissionPrefix = permissionPrefix.substring(0, permissionPrefix.length()-1);
|
permissionPrefix = permissionPrefix.substring(0, permissionPrefix.length()-1);
|
||||||
@ -357,6 +355,12 @@ public class User implements MetaDataAble {
|
|||||||
|
|
||||||
if (permissions.isEmpty()) return defaultValue;
|
if (permissions.isEmpty()) return defaultValue;
|
||||||
|
|
||||||
|
return iteratePerms(permissions, permPrefix, defaultValue);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private int iteratePerms(List<String> permissions, String permPrefix, int defaultValue) {
|
||||||
|
int value = 0;
|
||||||
for (String permission : permissions) {
|
for (String permission : permissions) {
|
||||||
if (permission.contains(permPrefix + "*")) {
|
if (permission.contains(permPrefix + "*")) {
|
||||||
// 'Star' permission
|
// 'Star' permission
|
||||||
|
Loading…
Reference in New Issue
Block a user