From 6cd8593fa5d976825c1fc80c28de44e9cbb319f6 Mon Sep 17 00:00:00 2001 From: Luck Date: Sun, 6 Nov 2016 15:11:28 +0000 Subject: [PATCH] Fix vault primary group override feature --- .../luckperms/bukkit/vault/VaultPermissionHook.java | 2 +- .../me/lucko/luckperms/common/core/PermissionHolder.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java index eb3a0a35..5b68c722 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/core/PermissionHolder.java b/common/src/main/java/me/lucko/luckperms/common/core/PermissionHolder.java index b76bc8a1..1f1db374 100644 --- a/common/src/main/java/me/lucko/luckperms/common/core/PermissionHolder.java +++ b/common/src/main/java/me/lucko/luckperms/common/core/PermissionHolder.java @@ -890,6 +890,15 @@ public abstract class PermissionHolder { .collect(Collectors.toList()); } + public List 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