Interface PermissionGroup

All Superinterfaces:
Comparable<PermissionGroup>, PermissionEntity

public interface PermissionGroup extends PermissionEntity, Comparable<PermissionGroup>
Classic group node in the PermissionsEx inheritance graph.

Extends PermissionEntity and adds group hierarchy, weight-based ordering, rank-ladder metadata, membership listing, and default-group flags. Concrete implementations live in permissionsex-core (DefaultPermissionGroup). Groups are ordered by getWeight() via Comparable.

Inherited PermissionEntity capabilities include (non-exhaustive): identity and lifecycle (PermissionEntity.getIdentifier(), PermissionEntity.getName(), PermissionEntity.initialize(), PermissionEntity.save(), PermissionEntity.remove()), permission checks and mutation (PermissionEntity.has(String), PermissionEntity.addPermission(String, String), PermissionEntity.setPermissions(List, String)), prefix/suffix/options (PermissionEntity.getPrefix(String), PermissionEntity.setOption(String, String, String)), and parent resolution (PermissionEntity.getParents(String), PermissionEntity.getOwnParents(String), PermissionEntity.setParents(List, String)).

Child vs. descendant groups: getChildGroups(String) returns groups that list this group as a direct parent. getDescendantGroups(String) returns all groups reachable through the inheritance tree below this group (children, grandchildren, and so on).

World-scoped overloads use null for the global (common) context when no world is specified.

  • Method Details

    • getWeight

      int getWeight()
      Returns the sort weight of this group.

      Higher weights sort later when groups are ordered for inheritance resolution. The weight is typically stored as a weight option on the group.

      Returns:
      group weight; 0 when unset
    • setWeight

      void setWeight(int weight)
      Sets the sort weight of this group.
      Parameters:
      weight - new weight value
    • isRanked

      boolean isRanked()
      Returns whether this group participates in a rank ladder.
      Returns:
      true if getRank() is greater than zero
    • getRank

      int getRank()
      Returns this group's numeric rank on its ladder.

      Lower numbers denote higher standing. Returns 0 when the group is not ranked.

      Returns:
      rank value, or 0 if not ranked
    • setRank

      void setRank(int rank)
      Sets this group's rank on its ladder.

      Specify 0 to remove the group from ranking.

      Parameters:
      rank - rank value; 0 clears ranking
    • getRankLadder

      String getRankLadder()
      Returns the name of the rank ladder this group belongs to.
      Returns:
      ladder name; implementations typically default unset values to "default"
    • setRankLadder

      void setRankLadder(String rankLadder)
      Sets the rank ladder for this group.
      Parameters:
      rankLadder - ladder name; empty or "default" typically clears to the default ladder
    • isChildOf

      boolean isChildOf(PermissionGroup group, String worldName, boolean checkInheritance)
      Checks whether this group inherits from the given group in a world context.

      When checkInheritance is true, any ancestor in the parent chain matches. When false, only a direct parent assignment matches.

      Parameters:
      group - candidate parent group
      worldName - world context, or null for the global context
      checkInheritance - true to walk the full parent chain; false for direct parent only
      Returns:
      true if this group is a child (direct or indirect) of group
    • isChildOf

      boolean isChildOf(PermissionGroup group, boolean checkInheritance)
      Checks whether this group inherits from the given group in any known world or the global context.
      Parameters:
      group - candidate parent group
      checkInheritance - true to walk the full parent chain; false for direct parent only
      Returns:
      true if this group is a child of group in at least one context
      See Also:
    • isChildOf

      boolean isChildOf(PermissionGroup group, String worldName)
      Checks whether the given group is a direct parent of this group in a world context.
      Parameters:
      group - candidate parent group
      worldName - world context, or null for the global context
      Returns:
      true if group is an immediate parent
      See Also:
    • isChildOf

      boolean isChildOf(PermissionGroup group)
      Checks whether the given group is a direct parent of this group in the global context.
      Parameters:
      group - candidate parent group
      Returns:
      true if group is an immediate parent
      See Also:
    • isChildOf

      boolean isChildOf(String groupName, String worldName, boolean checkInheritance)
      Checks whether this group inherits from the named group in a world context.
      Parameters:
      groupName - name of the candidate parent group
      worldName - world context, or null for the global context
      checkInheritance - true to walk the full parent chain; false for direct parent only
      Returns:
      true if this group is a child (direct or indirect) of the named group
      See Also:
    • isChildOf

      boolean isChildOf(String groupName, boolean checkInheritance)
      Checks whether this group inherits from the named group in any known world or the global context.
      Parameters:
      groupName - name of the candidate parent group
      checkInheritance - true to walk the full parent chain; false for direct parent only
      Returns:
      true if this group is a child of the named group in at least one context
      See Also:
    • isChildOf

      boolean isChildOf(String groupName, String worldName)
      Checks whether the named group is a direct parent of this group in a world context.
      Parameters:
      groupName - name of the candidate parent group
      worldName - world context, or null for the global context
      Returns:
      true if the named group is an immediate parent
      See Also:
    • isChildOf

      boolean isChildOf(String groupName)
      Checks whether the named group is a direct parent of this group in the global context.
      Parameters:
      groupName - name of the candidate parent group
      Returns:
      true if the named group is an immediate parent
      See Also:
    • getChildGroups

      List<PermissionGroup> getChildGroups(String worldName)
      Returns groups that have this group as a direct parent in the given world context.

      Does not include deeper descendants; use getDescendantGroups(String) for the full subtree.

      Parameters:
      worldName - world context, or null for the global context
      Returns:
      list of immediate child groups; never null
    • getChildGroups

      List<PermissionGroup> getChildGroups()
      Returns groups that have this group as a direct parent in the global context.
      Returns:
      list of immediate child groups; never null
      See Also:
    • getDescendantGroups

      List<PermissionGroup> getDescendantGroups(String worldName)
      Returns all groups below this one in the inheritance tree for the given world context.

      Includes direct children and every group reachable through nested parent links (descendants).

      Parameters:
      worldName - world context, or null for the global context
      Returns:
      list of descendant groups; never null
      See Also:
    • getDescendantGroups

      List<PermissionGroup> getDescendantGroups()
      Returns all groups below this one in the inheritance tree in the global context.
      Returns:
      list of descendant groups; never null
      See Also:
    • getUsers

      Set<PermissionUser> getUsers(String worldName)
      Returns users directly assigned to this group in the given world context.

      Loads membership from the backend; includes users that may not currently be loaded in memory. Does not include users who inherit this group only through another group.

      Parameters:
      worldName - world context, or null for the global context
      Returns:
      set of direct member users; never null
    • getUsers

      Set<PermissionUser> getUsers()
      Returns users directly assigned to this group across all contexts.
      Returns:
      set of direct member users; never null
      See Also:
    • getActiveUsers

      Set<PermissionUser> getActiveUsers()
      Returns users currently loaded in memory who belong to this group.

      Only considers direct membership (same as getActiveUsers(boolean) with inheritance = false). For users assigned to descendant groups, use getActiveUsers(boolean) with inheritance = true.

      Returns:
      set of active, directly assigned users; never null
      See Also:
    • getActiveUsers

      Set<PermissionUser> getActiveUsers(boolean inheritance)
      Returns users currently loaded in memory who belong to this group.

      When inheritance is false, only users with a direct parent assignment to this group are included. When true, users assigned to any descendant group of this group are also included (matching PermissionUser.inGroup(String, boolean) semantics).

      Parameters:
      inheritance - true to include users in descendant groups; false for direct members only
      Returns:
      set of matching active users; never null
    • isDefault

      boolean isDefault(String worldName)
      Returns whether this group is marked as the default group in the given world context.
      Parameters:
      worldName - world context, or null for the global context
      Returns:
      true if the group is a default group for new users in that context
    • setDefault

      void setDefault(boolean def, String worldName)
      Marks or clears this group as the default group in the given world context.
      Parameters:
      def - true to mark as default; false to clear
      worldName - world context, or null for the global context
    • addParent

      void addParent(PermissionGroup parent, String worldName)
      Adds a direct parent group in the given world context.

      No-op if the parent is already assigned. Does not create duplicate entries.

      Parameters:
      parent - parent group to add; no-op if null
      worldName - world context, or null for the global context
    • addParent

      void addParent(PermissionGroup parent)
      Adds a direct parent group in the global context.
      Parameters:
      parent - parent group to add; no-op if null
      See Also:
    • addParent

      void addParent(String parentName, String worldName)
      Adds a direct parent group by name in the given world context.
      Parameters:
      parentName - name of the parent group
      worldName - world context, or null for the global context
      See Also:
    • addParent

      void addParent(String parentName)
      Adds a direct parent group by name in the global context.
      Parameters:
      parentName - name of the parent group
      See Also:
    • removeParent

      void removeParent(PermissionGroup parent, String worldName)
      Removes a direct parent group in the given world context.
      Parameters:
      parent - parent group to remove; no-op if null
      worldName - world context, or null for the global context
    • removeParent

      void removeParent(PermissionGroup parent)
      Removes a direct parent group in the global context.
      Parameters:
      parent - parent group to remove; no-op if null
      See Also:
    • removeParent

      void removeParent(String parentName, String worldName)
      Removes a direct parent group by name in the given world context.
      Parameters:
      parentName - name of the parent group to remove
      worldName - world context, or null for the global context
      See Also:
    • removeParent

      void removeParent(String parentName)
      Removes a direct parent group by name in the global context.
      Parameters:
      parentName - name of the parent group to remove
      See Also:
    • getParentGroupsNames

      @Deprecated String[] getParentGroupsNames(String worldName)
      Returns direct parent group names in the given world context.
      Parameters:
      worldName - world context, or null for the global context
      Returns:
      array of own parent group names
    • getParentGroupsNames

      @Deprecated String[] getParentGroupsNames()
      Returns direct parent group names in the global context.
      Returns:
      array of own parent group names
    • setParentGroups

      @Deprecated void setParentGroups(List<String> parentGroups, String worldName)
      Replaces direct parent groups by name in the given world context.
      Parameters:
      parentGroups - new parent group names
      worldName - world context, or null for the global context
    • setParentGroups

      @Deprecated void setParentGroups(List<String> parentGroups)
      Replaces direct parent groups by name in the global context.
      Parameters:
      parentGroups - new parent group names
    • setParentGroupObjects

      @Deprecated void setParentGroupObjects(List<PermissionGroup> parentGroups, String worldName)
      Replaces direct parent groups in the given world context.
      Parameters:
      parentGroups - new parent group objects
      worldName - world context, or null for the global context
    • setParentGroupObjects

      @Deprecated void setParentGroupObjects(List<PermissionGroup> parentGroups)
      Deprecated.
      Replaces direct parent groups in the global context.
      Parameters:
      parentGroups - new parent group objects
    • getParentGroups

      @Deprecated List<PermissionGroup> getParentGroups(String worldName)
      Deprecated.
      Returns parent groups in the given world context, including inherited parents.
      Parameters:
      worldName - world context, or null for the global context
      Returns:
      list of parent groups
    • getParentGroups

      @Deprecated List<PermissionGroup> getParentGroups()
      Deprecated.
      Returns parent groups in the global context, including inherited parents.
      Returns:
      list of parent groups
    • getAllParentGroups

      @Deprecated Map<String,List<PermissionGroup>> getAllParentGroups()
      Deprecated.
      Returns all parent groups keyed by world name, including inherited parents.
      Returns:
      map of world name to parent group lists