Interface PermissionGroup
- All Superinterfaces:
Comparable<PermissionGroup>,PermissionEntity
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ru.tehkode.permissions.PermissionEntity
PermissionEntity.Type -
Field Summary
Fields inherited from interface ru.tehkode.permissions.PermissionEntity
NON_INHERITABLE_PREFIX -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a direct parent group by name in the global context.voidAdds a direct parent group by name in the given world context.voidaddParent(PermissionGroup parent) Adds a direct parent group in the global context.voidaddParent(PermissionGroup parent, String worldName) Adds a direct parent group in the given world context.Returns users currently loaded in memory who belong to this group.getActiveUsers(boolean inheritance) Returns users currently loaded in memory who belong to this group.Deprecated.Returns groups that have this group as a direct parent in the global context.getChildGroups(String worldName) Returns groups that have this group as a direct parent in the given world context.Returns all groups below this one in the inheritance tree in the global context.getDescendantGroups(String worldName) Returns all groups below this one in the inheritance tree for the given world context.Deprecated.UsePermissionEntity.getParents()instead.getParentGroups(String worldName) Deprecated.UsePermissionEntity.getParents(String)instead.String[]Deprecated.UsePermissionEntity.getOwnParentIdentifiers()instead.String[]getParentGroupsNames(String worldName) Deprecated.UsePermissionEntity.getOwnParentIdentifiers(String)instead.intgetRank()Returns this group's numeric rank on its ladder.Returns the name of the rank ladder this group belongs to.getUsers()Returns users directly assigned to this group across all contexts.Returns users directly assigned to this group in the given world context.intReturns the sort weight of this group.booleanChecks whether the named group is a direct parent of this group in the global context.booleanChecks whether this group inherits from the named group in any known world or the global context.booleanChecks whether the named group is a direct parent of this group in a world context.booleanChecks whether this group inherits from the named group in a world context.booleanisChildOf(PermissionGroup group) Checks whether the given group is a direct parent of this group in the global context.booleanisChildOf(PermissionGroup group, boolean checkInheritance) Checks whether this group inherits from the given group in any known world or the global context.booleanisChildOf(PermissionGroup group, String worldName) Checks whether the given group is a direct parent of this group in a world context.booleanisChildOf(PermissionGroup group, String worldName, boolean checkInheritance) Checks whether this group inherits from the given group in a world context.booleanReturns whether this group is marked as the default group in the given world context.booleanisRanked()Returns whether this group participates in a rank ladder.voidremoveParent(String parentName) Removes a direct parent group by name in the global context.voidremoveParent(String parentName, String worldName) Removes a direct parent group by name in the given world context.voidremoveParent(PermissionGroup parent) Removes a direct parent group in the global context.voidremoveParent(PermissionGroup parent, String worldName) Removes a direct parent group in the given world context.voidsetDefault(boolean def, String worldName) Marks or clears this group as the default group in the given world context.voidsetParentGroupObjects(List<PermissionGroup> parentGroups) Deprecated.UsePermissionEntity.setParents(List)instead.voidsetParentGroupObjects(List<PermissionGroup> parentGroups, String worldName) Deprecated.UsePermissionEntity.setParents(List, String)instead.voidsetParentGroups(List<String> parentGroups) Deprecated.UsePermissionEntity.setParentsIdentifier(List)instead.voidsetParentGroups(List<String> parentGroups, String worldName) Deprecated.UsePermissionEntity.setParentsIdentifier(List, String)instead.voidsetRank(int rank) Sets this group's rank on its ladder.voidsetRankLadder(String rankLadder) Sets the rank ladder for this group.voidsetWeight(int weight) Sets the sort weight of this group.Methods inherited from interface java.lang.Comparable
compareToMethods inherited from interface ru.tehkode.permissions.PermissionEntity
addPermission, addPermission, addTimedPermission, clearCache, explainExpression, getAllOptions, getAllParents, getAllPermissions, getIdentifier, getMatchingExpression, getMatchingExpression, getName, getOption, getOption, getOption, getOptionBoolean, getOptionDouble, getOptionInteger, getOptions, getOptions, getOwnOption, getOwnOption, getOwnOption, getOwnOptionBoolean, getOwnOptionDouble, getOwnOptionInteger, getOwnParentIdentifiers, getOwnParentIdentifiers, getOwnParents, getOwnParents, getOwnPermissions, getOwnPrefix, getOwnPrefix, getOwnSuffix, getOwnSuffix, getParentIdentifiers, getParentIdentifiers, getParents, getParents, getPermissionManager, getPermissions, getPermissions, getPrefix, getPrefix, getSuffix, getSuffix, getTimedPermissionLifetime, getTimedPermissions, getType, getWorlds, has, has, initialize, isDebug, isMatches, isVirtual, remove, removePermission, removePermission, removeTimedPermission, save, setDebug, setOption, setOption, setParents, setParents, setParentsIdentifier, setParentsIdentifier, setPermissions, setPermissions, setPrefix, setSuffix
-
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
weightoption on the group.- Returns:
- group weight;
0when 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:
trueifgetRank()is greater than zero
-
getRank
int getRank()Returns this group's numeric rank on its ladder.Lower numbers denote higher standing. Returns
0when the group is not ranked.- Returns:
- rank value, or
0if not ranked
-
setRank
void setRank(int rank) Sets this group's rank on its ladder.Specify
0to remove the group from ranking.- Parameters:
rank- rank value;0clears 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
Sets the rank ladder for this group.- Parameters:
rankLadder- ladder name; empty or"default"typically clears to the default ladder
-
isChildOf
Checks whether this group inherits from the given group in a world context.When
checkInheritanceistrue, any ancestor in the parent chain matches. Whenfalse, only a direct parent assignment matches.- Parameters:
group- candidate parent groupworldName- world context, ornullfor the global contextcheckInheritance-trueto walk the full parent chain;falsefor direct parent only- Returns:
trueif this group is a child (direct or indirect) ofgroup
-
isChildOf
Checks whether this group inherits from the given group in any known world or the global context.- Parameters:
group- candidate parent groupcheckInheritance-trueto walk the full parent chain;falsefor direct parent only- Returns:
trueif this group is a child ofgroupin at least one context- See Also:
-
isChildOf
Checks whether the given group is a direct parent of this group in a world context.- Parameters:
group- candidate parent groupworldName- world context, ornullfor the global context- Returns:
trueifgroupis an immediate parent- See Also:
-
isChildOf
Checks whether the given group is a direct parent of this group in the global context.- Parameters:
group- candidate parent group- Returns:
trueifgroupis an immediate parent- See Also:
-
isChildOf
Checks whether this group inherits from the named group in a world context.- Parameters:
groupName- name of the candidate parent groupworldName- world context, ornullfor the global contextcheckInheritance-trueto walk the full parent chain;falsefor direct parent only- Returns:
trueif this group is a child (direct or indirect) of the named group- See Also:
-
isChildOf
Checks whether this group inherits from the named group in any known world or the global context.- Parameters:
groupName- name of the candidate parent groupcheckInheritance-trueto walk the full parent chain;falsefor direct parent only- Returns:
trueif this group is a child of the named group in at least one context- See Also:
-
isChildOf
Checks whether the named group is a direct parent of this group in a world context.- Parameters:
groupName- name of the candidate parent groupworldName- world context, ornullfor the global context- Returns:
trueif the named group is an immediate parent- See Also:
-
isChildOf
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:
trueif the named group is an immediate parent- See Also:
-
getChildGroups
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, ornullfor 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
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, ornullfor 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
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, ornullfor 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)withinheritance = false). For users assigned to descendant groups, usegetActiveUsers(boolean)withinheritance = true.- Returns:
- set of active, directly assigned users; never
null - See Also:
-
getActiveUsers
Returns users currently loaded in memory who belong to this group.When
inheritanceisfalse, only users with a direct parent assignment to this group are included. Whentrue, users assigned to any descendant group of this group are also included (matchingPermissionUser.inGroup(String, boolean)semantics).- Parameters:
inheritance-trueto include users in descendant groups;falsefor direct members only- Returns:
- set of matching active users; never
null
-
isDefault
Returns whether this group is marked as the default group in the given world context.- Parameters:
worldName- world context, ornullfor the global context- Returns:
trueif the group is a default group for new users in that context
-
setDefault
Marks or clears this group as the default group in the given world context.- Parameters:
def-trueto mark as default;falseto clearworldName- world context, ornullfor the global context
-
addParent
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 ifnullworldName- world context, ornullfor the global context
-
addParent
Adds a direct parent group in the global context.- Parameters:
parent- parent group to add; no-op ifnull- See Also:
-
addParent
Adds a direct parent group by name in the given world context.- Parameters:
parentName- name of the parent groupworldName- world context, ornullfor the global context- See Also:
-
addParent
Adds a direct parent group by name in the global context.- Parameters:
parentName- name of the parent group- See Also:
-
removeParent
Removes a direct parent group in the given world context.- Parameters:
parent- parent group to remove; no-op ifnullworldName- world context, ornullfor the global context
-
removeParent
Removes a direct parent group in the global context.- Parameters:
parent- parent group to remove; no-op ifnull- See Also:
-
removeParent
Removes a direct parent group by name in the given world context.- Parameters:
parentName- name of the parent group to removeworldName- world context, ornullfor the global context- See Also:
-
removeParent
Removes a direct parent group by name in the global context.- Parameters:
parentName- name of the parent group to remove- See Also:
-
getParentGroupsNames
Deprecated.UsePermissionEntity.getOwnParentIdentifiers(String)instead.Returns direct parent group names in the given world context.- Parameters:
worldName- world context, ornullfor the global context- Returns:
- array of own parent group names
-
getParentGroupsNames
Deprecated.UsePermissionEntity.getOwnParentIdentifiers()instead.Returns direct parent group names in the global context.- Returns:
- array of own parent group names
-
setParentGroups
Deprecated.UsePermissionEntity.setParentsIdentifier(List, String)instead.Replaces direct parent groups by name in the given world context.- Parameters:
parentGroups- new parent group namesworldName- world context, ornullfor the global context
-
setParentGroups
Deprecated.UsePermissionEntity.setParentsIdentifier(List)instead.Replaces direct parent groups by name in the global context.- Parameters:
parentGroups- new parent group names
-
setParentGroupObjects
Deprecated.UsePermissionEntity.setParents(List, String)instead.Replaces direct parent groups in the given world context.- Parameters:
parentGroups- new parent group objectsworldName- world context, ornullfor the global context
-
setParentGroupObjects
Deprecated.UsePermissionEntity.setParents(List)instead.Replaces direct parent groups in the global context.- Parameters:
parentGroups- new parent group objects
-
getParentGroups
Deprecated.UsePermissionEntity.getParents(String)instead.Returns parent groups in the given world context, including inherited parents.- Parameters:
worldName- world context, ornullfor the global context- Returns:
- list of parent groups
-
getParentGroups
Deprecated.UsePermissionEntity.getParents()instead.Returns parent groups in the global context, including inherited parents.- Returns:
- list of parent groups
-
getAllParentGroups
Deprecated.UsePermissionEntity.getAllParents()instead.Returns all parent groups keyed by world name, including inherited parents.- Returns:
- map of world name to parent group lists
-
PermissionEntity.getAllParents()instead.