Search in sources :

Example 1 with ImmutableLocalizedNode

use of me.lucko.luckperms.common.node.ImmutableLocalizedNode in project LuckPerms by lucko.

the class PermissionHolder method accumulateInheritancesTo.

private void accumulateInheritancesTo(List<LocalizedNode> accumulator, Contexts context) {
    InheritanceGraph graph = this.plugin.getInheritanceHandler().getGraph(context);
    Iterable<PermissionHolder> traversal = graph.traverse(this.plugin.getConfiguration().get(ConfigKeys.INHERITANCE_TRAVERSAL_ALGORITHM), this);
    for (PermissionHolder holder : traversal) {
        List<Node> nodes = holder.getOwnNodes(context.getContexts());
        for (Node node : nodes) {
            ImmutableLocalizedNode localizedNode = ImmutableLocalizedNode.of(node, holder.getObjectName());
            accumulator.add(localizedNode);
        }
    }
}
Also used : ImmutableLocalizedNode(me.lucko.luckperms.common.node.ImmutableLocalizedNode) LocalizedNode(me.lucko.luckperms.api.LocalizedNode) ImmutableLocalizedNode(me.lucko.luckperms.common.node.ImmutableLocalizedNode) Node(me.lucko.luckperms.api.Node) InheritanceGraph(me.lucko.luckperms.common.inheritance.InheritanceGraph)

Example 2 with ImmutableLocalizedNode

use of me.lucko.luckperms.common.node.ImmutableLocalizedNode in project LuckPerms by lucko.

the class PermissionHolder method accumulateInheritancesTo.

private void accumulateInheritancesTo(List<LocalizedNode> accumulator) {
    InheritanceGraph graph = this.plugin.getInheritanceHandler().getGraph();
    Iterable<PermissionHolder> traversal = graph.traverse(this.plugin.getConfiguration().get(ConfigKeys.INHERITANCE_TRAVERSAL_ALGORITHM), this);
    for (PermissionHolder holder : traversal) {
        List<Node> nodes = holder.getOwnNodes();
        for (Node node : nodes) {
            ImmutableLocalizedNode localizedNode = ImmutableLocalizedNode.of(node, holder.getObjectName());
            accumulator.add(localizedNode);
        }
    }
}
Also used : ImmutableLocalizedNode(me.lucko.luckperms.common.node.ImmutableLocalizedNode) LocalizedNode(me.lucko.luckperms.api.LocalizedNode) ImmutableLocalizedNode(me.lucko.luckperms.common.node.ImmutableLocalizedNode) Node(me.lucko.luckperms.api.Node) InheritanceGraph(me.lucko.luckperms.common.inheritance.InheritanceGraph)

Example 3 with ImmutableLocalizedNode

use of me.lucko.luckperms.common.node.ImmutableLocalizedNode in project LuckPerms by lucko.

the class PermissionHolder method getAllEntries.

private List<LocalizedNode> getAllEntries(Contexts context) {
    List<LocalizedNode> entries = new LinkedList<>();
    if (context.hasSetting(LookupSetting.RESOLVE_INHERITANCE)) {
        accumulateInheritancesTo(entries, context);
    } else {
        for (Node n : getOwnNodes(context.getContexts())) {
            ImmutableLocalizedNode localizedNode = ImmutableLocalizedNode.of(n, getObjectName());
            entries.add(localizedNode);
        }
    }
    if (!context.hasSetting(LookupSetting.INCLUDE_NODES_SET_WITHOUT_SERVER)) {
        entries.removeIf(n -> !n.isGroupNode() && !n.isServerSpecific());
    }
    if (!context.hasSetting(LookupSetting.INCLUDE_NODES_SET_WITHOUT_WORLD)) {
        entries.removeIf(n -> !n.isGroupNode() && !n.isWorldSpecific());
    }
    return entries;
}
Also used : ImmutableLocalizedNode(me.lucko.luckperms.common.node.ImmutableLocalizedNode) LocalizedNode(me.lucko.luckperms.api.LocalizedNode) ImmutableLocalizedNode(me.lucko.luckperms.common.node.ImmutableLocalizedNode) Node(me.lucko.luckperms.api.Node) LocalizedNode(me.lucko.luckperms.api.LocalizedNode) ImmutableLocalizedNode(me.lucko.luckperms.common.node.ImmutableLocalizedNode) LinkedList(java.util.LinkedList)

Aggregations

LocalizedNode (me.lucko.luckperms.api.LocalizedNode)3 Node (me.lucko.luckperms.api.Node)3 ImmutableLocalizedNode (me.lucko.luckperms.common.node.ImmutableLocalizedNode)3 InheritanceGraph (me.lucko.luckperms.common.inheritance.InheritanceGraph)2 LinkedList (java.util.LinkedList)1