mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-01 05:57:51 +01:00
Determine dynamic primary groups using current context
This commit is contained in:
parent
1f54bc41cc
commit
f305f8d822
@ -51,7 +51,8 @@ public class AllParentsByWeightHolder extends StoredHolder {
|
||||
return cachedValue;
|
||||
}
|
||||
|
||||
cachedValue = user.resolveInheritancesAlmostEqual(ExtractedContexts.generate(Contexts.allowAll())).stream()
|
||||
Contexts contexts = user.getPlugin().getContextForUser(user);
|
||||
cachedValue = user.resolveInheritancesAlmostEqual(ExtractedContexts.generate(contexts)).stream()
|
||||
.filter(Node::isGroupNode)
|
||||
.filter(Node::getValue)
|
||||
.map(n -> Optional.ofNullable(user.getPlugin().getGroupManager().getIfLoaded(n.getGroupName())))
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
package me.lucko.luckperms.common.primarygroup;
|
||||
|
||||
import me.lucko.luckperms.api.Contexts;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
@ -49,7 +50,8 @@ public class ParentsByWeightHolder extends StoredHolder {
|
||||
return cachedValue;
|
||||
}
|
||||
|
||||
cachedValue = user.mergePermissionsToList().stream()
|
||||
Contexts contexts = user.getPlugin().getContextForUser(user);
|
||||
cachedValue = user.flattenAndMergeNodesToList(contexts.getContexts()).stream()
|
||||
.filter(Node::isGroupNode)
|
||||
.filter(Node::getValue)
|
||||
.map(n -> Optional.ofNullable(user.getPlugin().getGroupManager().getIfLoaded(n.getGroupName())))
|
||||
|
Loading…
Reference in New Issue
Block a user