diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java index d86d48c7d7..66e935a179 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java @@ -158,6 +158,7 @@ public int hasPermissionRange( } final String[] nodes = stub.split("\\."); final StringBuilder n = new StringBuilder(); + // Wildcard check from less specific permission to more specific permission for (int i = 0; i < (nodes.length - 1); i++) { n.append(nodes[i]).append("."); if (!stub.equals(n + Permission.PERMISSION_STAR.toString())) { @@ -166,9 +167,11 @@ public int hasPermissionRange( } } } + // Wildcard check for the full permission if (hasPermission(stub + ".*")) { return Integer.MAX_VALUE; } + // Permission value cache for iterative check int max = 0; if (CHECK_EFFECTIVE) { boolean hasAny = false; diff --git a/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java b/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java index b6ab5fff99..7987bfb037 100644 --- a/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java @@ -103,6 +103,7 @@ private static boolean checkPermValue( if (flag instanceof IntegerFlag && MathMan.isInteger(value)) { try { int numeric = Integer.parseInt(value); + // Getting full permission without "." at the end perm = perm.substring(0, perm.length() - value.length() - 1); boolean result = false; if (numeric >= 0) { diff --git a/Core/src/main/java/com/plotsquared/core/permissions/PermissionHolder.java b/Core/src/main/java/com/plotsquared/core/permissions/PermissionHolder.java index 3b483f45b2..8a21d8c5df 100644 --- a/Core/src/main/java/com/plotsquared/core/permissions/PermissionHolder.java +++ b/Core/src/main/java/com/plotsquared/core/permissions/PermissionHolder.java @@ -100,6 +100,7 @@ default int hasPermissionRange( } String[] nodes = stub.split("\\."); StringBuilder builder = new StringBuilder(); + // Wildcard check from less specific permission to more specific permission for (int i = 0; i < (nodes.length - 1); i++) { builder.append(nodes[i]).append("."); if (!stub.equals(builder + Permission.PERMISSION_STAR.toString())) { @@ -108,6 +109,7 @@ default int hasPermissionRange( } } } + // Wildcard check for the full permission if (hasPermission(stub + ".*")) { return Integer.MAX_VALUE; }