Fix vault primary group override feature

This commit is contained in:
Luck 2016-11-06 15:11:28 +00:00
parent 5ebbc178a5
commit 6cd8593fa5
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 10 additions and 1 deletions

View File

@ -376,7 +376,7 @@ public class VaultPermissionHook extends Permission {
}
if (pgoCheckMemberOf) {
if (!user.getLocalGroups(server, world).contains(group.toLowerCase())) {
if (!user.getLocalGroups(server, world, isIncludeGlobal()).contains(group.toLowerCase())) {
continue;
}
}

View File

@ -890,6 +890,15 @@ public abstract class PermissionHolder {
.collect(Collectors.toList());
}
public List<String> getLocalGroups(String server, String world, boolean includeGlobal) {
return getNodes().stream()
.filter(Node::isGroupNode)
.filter(n -> n.shouldApplyOnWorld(world, includeGlobal, true))
.filter(n -> n.shouldApplyOnServer(server, includeGlobal, true))
.map(Node::getGroupName)
.collect(Collectors.toList());
}
/**
* Get a {@link List} of the groups the holder inherits on a specific server
* @param server the server to check