Interface PermissionUser
- All Superinterfaces:
PermissionEntity
Extends PermissionEntity and adds group membership, rank-ladder promotion/demotion, and
timed group assignment. Concrete implementations live in permissionsex-core
(DefaultPermissionUser).
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), PermissionEntity.setPermissions(List, String)),
prefix/suffix/options (PermissionEntity.getPrefix(String), PermissionEntity.getOption(String, String)),
timed permissions (PermissionEntity.addTimedPermission(String, String, int)),
and parent/group resolution (PermissionEntity.getParents(String),
PermissionEntity.getOwnParents(String), PermissionEntity.setParents(List, String)).
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 this user to a group in the global context.voidAdds this user to a group in the given world context.voidAdds this user to a group for a limited time in the given world context.voidaddGroup(PermissionGroup group) Adds this user to a group in the global context.voidaddGroup(PermissionGroup group, String worldName) Adds this user to a group in the given world context.demote(PermissionUser demoter, String ladderName) Deprecated.Deprecated.UsePermissionEntity.getAllParents()instead.String[]Deprecated.UsePermissionEntity.getOwnParentIdentifiers()instead.String[]getGroupNames(String worldName) Deprecated.UsePermissionEntity.getOwnParentIdentifiers(String)instead.Deprecated.UsePermissionEntity.getParents()instead.Deprecated.UsePermissionEntity.getParents(String)instead.String[]Deprecated.UsePermissionEntity.getParentIdentifiers()instead.String[]getGroupsNames(String world) Deprecated.UsePermissionEntity.getParentIdentifiers(String)instead.intReturns this user's numeric rank on the given ladder.getRankLadderGroup(String ladder) Returns the group that places this user on the given rank ladder.Returns every rank ladder this user participates in and the corresponding group for each.booleanChecks whether this user belongs to the named group in any context, including inherited membership.booleanChecks whether this user belongs to the named group in any known world or the global context.booleanChecks whether this user belongs to the named group in a world context, including inherited membership.booleanChecks whether this user belongs to the named group in a world context.booleaninGroup(PermissionGroup group) Checks whether this user belongs to the given group in any context, including inherited membership.booleaninGroup(PermissionGroup group, boolean checkInheritance) Checks whether this user belongs to the given group in any known world or the global context.booleaninGroup(PermissionGroup group, String worldName) Checks whether this user belongs to the given group in a world context, including inherited membership.booleaninGroup(PermissionGroup group, String worldName, boolean checkInheritance) Checks whether this user belongs to the given group in a world context, optionally considering inherited (indirect) membership.booleanReturns whether this user holds a ranked group on the given ladder.promote(PermissionUser promoter, String ladderName) Deprecated.PreferPermissionsEx.getApi().getLadderManager().promote(user, ladderName)(moderndev.rono.permissions.api.ladder.LadderManager).voidremoveGroup(String groupName) Removes this user's direct membership in a group across all world contexts and the global context.voidremoveGroup(String groupName, String worldName) Removes this user's direct membership in a group for the given world context.voidremoveGroup(PermissionGroup group) Removes this user's direct membership in a group across all world contexts and the global context.voidremoveGroup(PermissionGroup group, String worldName) Removes this user's direct membership in a group for the given world context.voidDeprecated.UsePermissionEntity.setParentsIdentifier(List)instead.voidDeprecated.UsePermissionEntity.setParentsIdentifier(List, String)instead.voidsetGroups(PermissionGroup[] parentGroups) Deprecated.UsePermissionEntity.setParents(List)instead.voidsetGroups(PermissionGroup[] parentGroups, String worldName) Deprecated.UsePermissionEntity.setParents(List, String)instead.voidRemoves expired timed group memberships and schedules the next expiration check.Methods 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
-
getAllGroups
Deprecated.UsePermissionEntity.getAllParents()instead.Returns all parent groups for this user, keyed by world name.- Returns:
- map of world name to ordered list of parent groups (including inherited parents)
-
addGroup
Adds this user to a group in the given world context.The assignment is direct (own parent); it does not modify group inheritance trees.
- Parameters:
groupName- name of the group to joinworldName- world context, ornullfor the global context
-
addGroup
Adds this user to a group in the global context.- Parameters:
groupName- name of the group to join- See Also:
-
addGroup
Adds this user to a group in the given world context.- Parameters:
group- group to join; no-op ifnullworldName- world context, ornullfor the global context- See Also:
-
addGroup
Adds this user to a group in the global context.- Parameters:
group- group to join; no-op ifnull- See Also:
-
addGroup
Adds this user to a group for a limited time in the given world context.When
lifetimeis greater than zero, membership expires after that many seconds. Expiration is tracked via agroup-<name>-untiloption and enforced byupdateTimedGroups(). Alifetimeof zero behaves like a permanentaddGroup(String, String)call.- Parameters:
groupName- name of the group to joinworldName- world context, ornullfor the global contextlifetime- membership duration in seconds;0for no expiration
-
removeGroup
Removes this user's direct membership in a group for the given world context.- Parameters:
groupName- name of the group to leaveworldName- world context, ornullfor the global context
-
removeGroup
Removes this user's direct membership in a group across all world contexts and the global context.- Parameters:
groupName- name of the group to leave- See Also:
-
removeGroup
Removes this user's direct membership in a group for the given world context.- Parameters:
group- group to leave; no-op ifnullworldName- world context, ornullfor the global context- See Also:
-
removeGroup
Removes this user's direct membership in a group across all world contexts and the global context.- Parameters:
group- group to leave; no-op ifnull- See Also:
-
inGroup
Checks whether this user belongs to the given group in a world context, optionally considering inherited (indirect) membership.When
checkInheritanceistrue, membership is satisfied if the user is directly assigned togroupor to any group that is a descendant ofgroupin the inheritance tree. Whenfalse, only a direct parent assignment togroupcounts.- Parameters:
group- group to testworldName- world context, ornullfor the global contextcheckInheritance-trueto match descendant groups;falsefor direct membership only- Returns:
trueif the user is in the group under the given rules
-
inGroup
Checks whether this user belongs to the given group in any known world or the global context.- Parameters:
group- group to testcheckInheritance-trueto match descendant groups;falsefor direct membership only- Returns:
trueif the user is in the group in at least one context- See Also:
-
inGroup
Checks whether this user belongs to the named group in a world context.- Parameters:
groupName- name of the group to testworldName- world context, ornullfor the global contextcheckInheritance-trueto match descendant groups;falsefor direct membership only- Returns:
trueif the user is in the group under the given rules- See Also:
-
inGroup
Checks whether this user belongs to the named group in any known world or the global context.- Parameters:
groupName- name of the group to testcheckInheritance-trueto match descendant groups;falsefor direct membership only- Returns:
trueif the user is in the group in at least one context- See Also:
-
inGroup
Checks whether this user belongs to the given group in a world context, including inherited membership.- Parameters:
group- group to testworldName- world context, ornullfor the global context- Returns:
trueif the user is directly or indirectly in the group- See Also:
-
inGroup
Checks whether this user belongs to the given group in any context, including inherited membership.- Parameters:
group- group to test- Returns:
trueif the user is directly or indirectly in the group- See Also:
-
inGroup
Checks whether this user belongs to the named group in a world context, including inherited membership.- Parameters:
groupName- name of the group to testworldName- world context, ornullfor the global context- Returns:
trueif the user is directly or indirectly in the group- See Also:
-
inGroup
Checks whether this user belongs to the named group in any context, including inherited membership.- Parameters:
groupName- name of the group to test- Returns:
trueif the user is directly or indirectly in the group- See Also:
-
promote
@Deprecated(since="1.23.5") PermissionGroup promote(PermissionUser promoter, String ladderName) throws RankingException Deprecated.PreferPermissionsEx.getApi().getLadderManager().promote(user, ladderName)(moderndev.rono.permissions.api.ladder.LadderManager). This method remains for binary compatibility with hook plugins compiled against older releases.Promotes this user one step up on the specified rank ladder.Replaces the user's current ladder group with the next higher-ranked group on the same ladder. Only direct group assignments are changed; inherited parents are not modified.
If
promoteris non-null and ranked on the ladder, their rank must be strictly higher (numerically lower) than this user's rank. Passnullwhen the action is performed from the console or by a plugin without rank restrictions.- Parameters:
promoter- user authorizing the promotion, ornullfor unrestricted promotionladderName- rank ladder name; implementations typically default empty values to"default"- Returns:
- the group this user was promoted into
- Throws:
RankingException- if this user is not on the ladder, the promoter lacks sufficient rank, or no higher group exists on the ladder
-
demote
@Deprecated(since="1.23.5") PermissionGroup demote(PermissionUser demoter, String ladderName) throws RankingException Deprecated.PreferPermissionsEx.getApi().getLadderManager().demote(user, ladderName)(moderndev.rono.permissions.api.ladder.LadderManager). This method remains for binary compatibility with hook plugins compiled against older releases.Demotes this user one step down on the specified rank ladder.Replaces the user's current ladder group with the next lower-ranked group on the same ladder. Only direct group assignments are changed; inherited parents are not modified.
If
demoteris non-null and ranked on the ladder, their rank must be strictly higher (numerically lower) than this user's rank. Passnullwhen the action is performed from the console or by a plugin without rank restrictions.- Parameters:
demoter- user authorizing the demotion, ornullfor unrestricted demotionladderName- rank ladder name; implementations typically default empty values to"default"- Returns:
- the group this user was demoted into
- Throws:
RankingException- if this user is not on the ladder, the demoter lacks sufficient rank, or no lower group exists on the ladder
-
isRanked
Returns whether this user holds a ranked group on the given ladder.- Parameters:
ladder- rank ladder name- Returns:
trueifgetRank(String)would return a value greater than zero
-
getRank
Returns this user's numeric rank on the given ladder.Lower numbers denote higher standing on the ladder. Returns
0when the user is not ranked on that ladder.- Parameters:
ladder- rank ladder name- Returns:
- rank value, or
0if not ranked
-
getRankLadderGroup
Returns the group that places this user on the given rank ladder.- Parameters:
ladder- rank ladder name; implementations typically default empty values to"default"- Returns:
- the ranked group, or
nullif the user is not on the ladder
-
getRankLadders
Map<String,PermissionGroup> getRankLadders()Returns every rank ladder this user participates in and the corresponding group for each.- Returns:
- map of ladder name to the user's group on that ladder; never
null
-
updateTimedGroups
void updateTimedGroups()Removes expired timed group memberships and schedules the next expiration check.Scans
group-<name>-untiloptions set byaddGroup(String, String, long). Called automatically duringPermissionEntity.initialize()and after timed group assignment; plugins normally do not need to invoke this directly. -
getGroupsNames
Deprecated.UsePermissionEntity.getParentIdentifiers()instead.Returns parent group names for this user in the global context.- Returns:
- array of group names (including inherited parents)
-
getGroupsNames
Deprecated.UsePermissionEntity.getParentIdentifiers(String)instead.Returns parent group names for this user in the given world context.- Parameters:
world- world context, ornullfor the global context- Returns:
- array of group names (including inherited parents)
-
getGroups
Deprecated.UsePermissionEntity.getParents()instead.Returns parent groups for this user in the global context.- Returns:
- array of parent groups (including inherited parents)
-
getGroups
Deprecated.UsePermissionEntity.getParents(String)instead.Returns parent groups for this user in the given world context.- Parameters:
worldName- world context, ornullfor the global context- Returns:
- array of parent groups (including inherited parents)
-
getGroupNames
Deprecated.UsePermissionEntity.getOwnParentIdentifiers()instead.Returns own (direct) parent group names in the global context.- Returns:
- array of directly assigned group names
-
getGroupNames
Deprecated.UsePermissionEntity.getOwnParentIdentifiers(String)instead.Returns own (direct) parent group names in the given world context.- Parameters:
worldName- world context, ornullfor the global context- Returns:
- array of directly assigned group names
-
setGroups
Deprecated.UsePermissionEntity.setParentsIdentifier(List, String)instead.Replaces this user's direct parent groups in the given world context.- Parameters:
groups- new parent group namesworldName- world context, ornullfor the global context
-
setGroups
Deprecated.UsePermissionEntity.setParentsIdentifier(List)instead.Replaces this user's direct parent groups in the global context.- Parameters:
groups- new parent group names
-
setGroups
Deprecated.UsePermissionEntity.setParents(List, String)instead.Replaces this user's direct parent groups in the given world context.- Parameters:
parentGroups- new parent group objectsworldName- world context, ornullfor the global context
-
setGroups
Deprecated.UsePermissionEntity.setParents(List)instead.Replaces this user's direct parent groups in the global context.- Parameters:
parentGroups- new parent group objects
-
PermissionsEx.getApi().getLadderManager().demote(user, ladderName)(moderndev.rono.permissions.api.ladder.LadderManager).