@Override
    public Iterable<? extends PermissionHolder> successors(PermissionHolder holder) {
        Set<Group> successors = new LinkedHashSet<>();
        for (InheritanceNode n : holder.getOwnInheritanceNodes(this.queryOptions)) {
            Group g = this.plugin.getGroupManager().getIfLoaded(n.getGroupName());
            if (g != null) {
                successors.add(g);
            }
        }

        List<Group> successorsSorted = new ArrayList<>(successors);
        successorsSorted.sort(holder.getInheritanceComparator());
        return successorsSorted;
    }
The contexts to resolve inheritance in.
common/src/main/java/me/lucko/luckperms/common/inheritance/InheritanceGraph.java