mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-24 02:07:39 +00:00
Fix dinnerperms wildcard matching & group enumeration.
This commit is contained in:
parent
6f1d263e16
commit
703131107d
@ -26,16 +26,11 @@ public class DinnerPermsResolver implements PermissionsResolver {
|
|||||||
return false; // Permissions are only registered for online players
|
return false; // Permissions are only registered for online players
|
||||||
if ( player.hasPermission("*") || player.hasPermission(permission))
|
if ( player.hasPermission("*") || player.hasPermission(permission))
|
||||||
return true;
|
return true;
|
||||||
int i = 0;
|
int dotPos = permission.lastIndexOf(".");
|
||||||
while (i <= permission.length() + 1) {
|
while (dotPos > -1) {
|
||||||
int dotPos = permission.indexOf(".", i);
|
if (player.hasPermission(permission.substring(0, dotPos + 1) + "*"))
|
||||||
if (dotPos > -1) {
|
return true;
|
||||||
if (player.hasPermission(permission.substring(0, dotPos + 1) + "*"))
|
dotPos = permission.lastIndexOf(".", dotPos - 1);
|
||||||
return true;
|
|
||||||
i += dotPos;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -58,10 +53,10 @@ public class DinnerPermsResolver implements PermissionsResolver {
|
|||||||
List<String> groupNames = new ArrayList<String>();
|
List<String> groupNames = new ArrayList<String>();
|
||||||
for (PermissionAttachmentInfo permAttach : player.getEffectivePermissions()) {
|
for (PermissionAttachmentInfo permAttach : player.getEffectivePermissions()) {
|
||||||
String perm = permAttach.getPermission();
|
String perm = permAttach.getPermission();
|
||||||
if (!perm.startsWith(GROUP_PREFIX))
|
if (!(perm.startsWith(GROUP_PREFIX) || permAttach.getValue()))
|
||||||
continue;
|
continue;
|
||||||
groupNames.add(perm.substring(GROUP_PREFIX.length(), perm.length()));
|
groupNames.add(perm.substring(GROUP_PREFIX.length(), perm.length()));
|
||||||
}
|
}
|
||||||
return groupNames.toArray(new String[groupNames.size()]);
|
return groupNames.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user