Search in sources :

Example 1 with SpongeGroup

use of me.lucko.luckperms.sponge.model.SpongeGroup in project LuckPerms by lucko.

the class HolderSubject method getParents.

@Override
public ImmutableList<LPSubjectReference> getParents(ImmutableContextSet contexts) {
    InheritanceGraph graph = this.plugin.getInheritanceHandler().getGraph(this.plugin.getContextManager().formContexts(contexts));
    Iterable<PermissionHolder> traversal = graph.traverse(TraversalAlgorithm.DEPTH_FIRST_PRE_ORDER, this.parent);
    ImmutableList.Builder<LPSubjectReference> subjects = ImmutableList.builder();
    for (PermissionHolder parent : traversal) {
        if (!(parent instanceof Group)) {
            continue;
        }
        subjects.add(((SpongeGroup) parent).sponge().toReference());
    }
    return subjects.build();
}
Also used : Group(me.lucko.luckperms.common.model.Group) SpongeGroup(me.lucko.luckperms.sponge.model.SpongeGroup) ImmutableList(com.google.common.collect.ImmutableList) LPSubjectReference(me.lucko.luckperms.sponge.service.model.LPSubjectReference) SpongeGroup(me.lucko.luckperms.sponge.model.SpongeGroup) PermissionHolder(me.lucko.luckperms.common.model.PermissionHolder) InheritanceGraph(me.lucko.luckperms.common.inheritance.InheritanceGraph)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 InheritanceGraph (me.lucko.luckperms.common.inheritance.InheritanceGraph)1 Group (me.lucko.luckperms.common.model.Group)1 PermissionHolder (me.lucko.luckperms.common.model.PermissionHolder)1 SpongeGroup (me.lucko.luckperms.sponge.model.SpongeGroup)1 LPSubjectReference (me.lucko.luckperms.sponge.service.model.LPSubjectReference)1