@SuppressWarnings({"unchecked", "rawtypes"})
    public List<Group> resolveInheritanceTree(QueryOptions queryOptions) {
        InheritanceGraph graph = this.plugin.getInheritanceGraphFactory().getGraph(queryOptions);

        List<PermissionHolder> inheritanceTree = new ArrayList<>();

        if (queryOptions.flag(Flag.RESOLVE_INHERITANCE)) {
            Iterables.addAll(inheritanceTree, graph.traverse(this));
            inheritanceTree.remove(this);
        } else {
            // if RESOLVE_INHERITANCE is not set, only go up by one level
            Iterables.addAll(inheritanceTree, graph.successors(this));
        }

        // ensure our tree now only consists of groups
        for (PermissionHolder permissionHolder : inheritanceTree) {
            if (!(permissionHolder instanceof Group)) {
                throw new IllegalStateException("Non-group object in inheritance tree: " + permissionHolder);
            }
        }

        // cast List<PermissionHolder> to List<Group>
        // this feels a bit dirty but it works & avoids needless copying!
        return (List) inheritanceTree;
    }
Returns the type of this PermissionHolder.

@return this holders type
common/src/main/java/me/lucko/luckperms/common/model/PermissionHolder.java