Search in sources :

Example 1 with SubjectInheritanceGraph

use of me.lucko.luckperms.sponge.service.inheritance.SubjectInheritanceGraph in project LuckPerms by lucko.

the class CalculatedSubject method resolveAllOptions.

public void resolveAllOptions(MetaAccumulator accumulator, ImmutableContextSet filter) {
    SubjectInheritanceGraph graph = SubjectInheritanceGraphs.getGraph(filter);
    Iterable<CalculatedSubject> traversal = graph.traverse(TraversalAlgorithm.DEPTH_FIRST_PRE_ORDER, this);
    for (CalculatedSubject subject : traversal) {
        for (Map.Entry<String, String> entry : subject.getCombinedOptions(filter).entrySet()) {
            accumulator.accumulateMeta(entry.getKey(), entry.getValue());
        }
    }
}
Also used : SubjectInheritanceGraph(me.lucko.luckperms.sponge.service.inheritance.SubjectInheritanceGraph) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with SubjectInheritanceGraph

use of me.lucko.luckperms.sponge.service.inheritance.SubjectInheritanceGraph in project LuckPerms by lucko.

the class CalculatedSubject method resolveAllPermissions.

public Map<String, Boolean> resolveAllPermissions(ImmutableContextSet filter) {
    SubjectInheritanceGraph graph = SubjectInheritanceGraphs.getGraph(filter);
    Map<String, Boolean> result = new HashMap<>();
    Iterable<CalculatedSubject> traversal = graph.traverse(TraversalAlgorithm.DEPTH_FIRST_PRE_ORDER, this);
    for (CalculatedSubject subject : traversal) {
        for (Map.Entry<String, Boolean> entry : subject.getCombinedPermissions(filter).entrySet()) {
            result.putIfAbsent(entry.getKey(), entry.getValue());
        }
    }
    return result;
}
Also used : HashMap(java.util.HashMap) SubjectInheritanceGraph(me.lucko.luckperms.sponge.service.inheritance.SubjectInheritanceGraph) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with SubjectInheritanceGraph

use of me.lucko.luckperms.sponge.service.inheritance.SubjectInheritanceGraph in project LuckPerms by lucko.

the class CalculatedSubject method resolveAllParents.

public Set<LPSubjectReference> resolveAllParents(ImmutableContextSet filter) {
    SubjectInheritanceGraph graph = SubjectInheritanceGraphs.getGraph(filter);
    Set<LPSubjectReference> result = new LinkedHashSet<>();
    Iterable<CalculatedSubject> traversal = graph.traverse(TraversalAlgorithm.DEPTH_FIRST_PRE_ORDER, this);
    for (CalculatedSubject subject : traversal) {
        for (LPSubjectReference entry : subject.getCombinedParents(filter)) {
            if (!result.contains(entry)) {
                result.add(entry);
            }
        }
    }
    return result;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) LPSubjectReference(me.lucko.luckperms.sponge.service.model.LPSubjectReference) SubjectInheritanceGraph(me.lucko.luckperms.sponge.service.inheritance.SubjectInheritanceGraph)

Example 4 with SubjectInheritanceGraph

use of me.lucko.luckperms.sponge.service.inheritance.SubjectInheritanceGraph in project LuckPerms by lucko.

the class CalculatedSubject method resolveAllOptions.

public Map<String, String> resolveAllOptions() {
    SubjectInheritanceGraph graph = SubjectInheritanceGraphs.getGraph();
    Map<String, String> result = new HashMap<>();
    Iterable<CalculatedSubject> traversal = graph.traverse(TraversalAlgorithm.DEPTH_FIRST_PRE_ORDER, this);
    for (CalculatedSubject subject : traversal) {
        for (Map.Entry<String, String> entry : subject.getCombinedOptions().entrySet()) {
            result.putIfAbsent(entry.getKey(), entry.getValue());
        }
    }
    return result;
}
Also used : HashMap(java.util.HashMap) SubjectInheritanceGraph(me.lucko.luckperms.sponge.service.inheritance.SubjectInheritanceGraph) HashMap(java.util.HashMap) Map(java.util.Map)

Example 5 with SubjectInheritanceGraph

use of me.lucko.luckperms.sponge.service.inheritance.SubjectInheritanceGraph in project LuckPerms by lucko.

the class CalculatedSubject method resolveAllOptions.

public void resolveAllOptions(MetaAccumulator accumulator) {
    SubjectInheritanceGraph graph = SubjectInheritanceGraphs.getGraph();
    Iterable<CalculatedSubject> traversal = graph.traverse(TraversalAlgorithm.DEPTH_FIRST_PRE_ORDER, this);
    for (CalculatedSubject subject : traversal) {
        for (Map.Entry<String, String> entry : subject.getCombinedOptions().entrySet()) {
            accumulator.accumulateMeta(entry.getKey(), entry.getValue());
        }
    }
}
Also used : SubjectInheritanceGraph(me.lucko.luckperms.sponge.service.inheritance.SubjectInheritanceGraph) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

SubjectInheritanceGraph (me.lucko.luckperms.sponge.service.inheritance.SubjectInheritanceGraph)8 HashMap (java.util.HashMap)6 Map (java.util.Map)6 LinkedHashSet (java.util.LinkedHashSet)2 LPSubjectReference (me.lucko.luckperms.sponge.service.model.LPSubjectReference)2