Interface PermissionManager
ru.tehkode.permissions, baseline 628215f).
Registered on Bukkit ServicesManager as PermissionManager.class on game servers.
Runtime extensions (PlatformAdapter, entity bus dispatches, internal scheduling) are implemented on
dev.rono.permissions.core.InternalPermissionManager and are not part of this surface.
Classic methods remain for binary compatibility but are deprecated — use
PermissionsExApi via PermissionsEx.getApi().
World scope
A null world name denotes the global (common) scope shared across worlds unless
overridden by world-specific data. World inheritance (getWorldInheritance(String)) further
links named worlds to parent worlds when resolving effective permissions.
Inheritance flag overloads
getUsers(String, String, boolean) and getGroups(String, String, boolean) accept an
inheritance parameter: when true, descendant groups of the named group are included;
when false, only direct members or child groups are returned. Two-argument overloads default
inheritance to false.
Cache and reset semantics
cacheUser(String, String)— pre-materializes a user during async login (thread-safe).clearUserCache(String)— clears resolved permission state on a cached user without dropping the in-memory user object.resetUser(String)— removes the in-memory user; the next lookup reloads from the backend.resetGroup(String)— removes the in-memory group; the next lookup reloads from the backend.reset()— clears all in-memory users and groups, reloads the backend, and optionally fires a reload event.
Timed permissions
initTimer() starts the scheduler used to expire timed grants. TRANSIENT_PERMISSION
(0) marks a timed grant as non-persisted (in-memory only until reload).
Holder-based permissions
The addPermission(PermissionHolder, String), removePermission(PermissionHolder, String),
hasPermission(PermissionHolder, String), and getPermissions(PermissionHolder) methods operate on
PermissionHolder identities (for example User#asHolder() from the modern user API, group/world/ladder
holders, etc.). Resolve the manager via PermissionsEx.getApi().getPermissionManager().
World context for advanced adds is supplied through PermissionAddRequest.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLifetime value (0) indicating a timed permission is transient: held in memory only and not persisted to the backend. -
Method Summary
Modifier and TypeMethodDescriptionaddPermission(PermissionAddRequest request) Grants a permission using a fully specified add request (world context, expiry, source metadata).addPermission(PermissionHolder holder, String permission) Grants a permission to the given holder in the global scope (not world-specific).addPermission(PermissionHolder holder, String permission, Duration duration) Grants a permission to the holder in the global scope for a limited duration.voidDeprecated.voidclearUserCache(String userName) Deprecated.voidclearUserCache(UUID uid) Deprecated.voidclearUserCache(org.bukkit.entity.Player player) Deprecated.createBackend(String backendName) Deprecated.voidend()Deprecated.Deprecated.Deprecated.Deprecated.getDefaultGroups(String worldName) Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.prefergetGroupList()Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.getPermissions(PermissionHolder holder) Returns direct permission assignments for the holder in the global scope.getRankLadder(String ladderName) Deprecated.Deprecated.Deprecated.getUser(org.bukkit.entity.Player player) Deprecated.Deprecated.Deprecated.getUsers()Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.getWorldInheritance(String worldName) Deprecated.booleanDeprecated.booleanDeprecated.booleanDeprecated.booleanDeprecated.booleanhasPermission(PermissionHolder holder, String permission) Checks whether the holder effectively holds the permission in the global scope.default booleanhasPermission(PermissionHolder holder, String permission, PermissionContext context) Checks whether the holder effectively holds the permission incontext.booleanhasPermission(PermissionHolder holder, String permission, Map<String, String> context) Checks whether the holder effectively holds the permission in the scope described bycontext.voidDeprecated.booleanisDebug()Deprecated.voidremovePermission(PermissionHolder holder, String permission) Removes a direct permission assignment from the holder in the global scope.voidreset()Deprecated.voidreset(boolean callEvent) Deprecated.resetGroup(String groupName) Deprecated.voidDeprecated.voidresetUser(org.bukkit.entity.Player player) Deprecated.voidsetBackend(String backendName) Deprecated.voidsetDebug(boolean debug) Deprecated.voidsetPermissionMatcher(PermissionMatcher matcher) Deprecated.voidsetWorldInheritance(String world, List<String> parentWorlds) Deprecated.booleanDeprecated.booleanDeprecated.
-
Field Details
-
TRANSIENT_PERMISSION
static final int TRANSIENT_PERMISSIONLifetime value (0) indicating a timed permission is transient: held in memory only and not persisted to the backend.Passed to
PermissionEntity.addTimedPermission(String, String, int)aslifeTime.- See Also:
-
-
Method Details
-
addPermission
Grants a permission to the given holder in the global scope (not world-specific).The grant is persisted when the underlying entity is saved. For timed or world-scoped grants, use
addPermission(PermissionHolder, String, Duration)oraddPermission(PermissionAddRequest).- Parameters:
holder- permission target; must not benullpermission- permission node to grant; must not benullor empty- Returns:
- metadata describing the added node
- See Also:
-
addPermission
Grants a permission to the holder in the global scope for a limited duration.When
durationisnull, behaves likeaddPermission(PermissionHolder, String). Timed grants expire automatically after the scheduler runs (initTimer()).- Parameters:
holder- permission target; must not benullpermission- permission node to grant; must not benullor emptyduration- lifetime of the grant, ornullfor a permanent direct assignment- Returns:
- metadata describing the added node (including expiry when timed)
- See Also:
-
addPermission
Grants a permission using a fully specified add request (world context, expiry, source metadata).Build requests with
PermissionAddRequest.builder(). World keys in the request context map to world-scoped storage; an empty context uses the global scope.- Parameters:
request- add specification; must not benull- Returns:
- metadata describing the added node
- See Also:
-
removePermission
Removes a direct permission assignment from the holder in the global scope.Does not remove inherited permissions. Does not clear timed nodes in world-specific scopes; use
PermissionEntity.removeTimedPermission(String, String)on the resolved classic entity when needed.- Parameters:
holder- permission target; must not benullpermission- permission node to remove; must not benull
-
hasPermission
Checks whether the holder effectively holds the permission in the global scope.Includes inheritance and parent groups for user/group holders. For per-world effective checks, use the classic
has(Player, String, String)API orhasPermission(PermissionHolder, String, Map)with aworldcontext entry.- Parameters:
holder- permission target; must not benullpermission- permission node to check; must not benull- Returns:
trueif granted after inheritance,falseotherwise- See Also:
-
hasPermission
Checks whether the holder effectively holds the permission in the scope described bycontext.The
worldentry incontextselects the world/realm namespace (same as classic per-world checks). An empty or missing context uses the global namespace.- Parameters:
holder- permission target; must not benullpermission- permission node to check; must not benullcontext- optional context map (for exampleMap.of("world", player.getWorld().getName()))- Returns:
trueif granted after inheritance,falseotherwise- See Also:
-
hasPermission
default boolean hasPermission(PermissionHolder holder, String permission, PermissionContext context) Checks whether the holder effectively holds the permission incontext.- Parameters:
holder- permission target; must not benullpermission- permission node to check; must not benullcontext- permission scope- Returns:
trueif granted after inheritance,falseotherwise
-
getPermissions
Returns direct permission assignments for the holder in the global scope.Does not include inherited nodes or world-specific assignments. Each entry is a
PermissionNodewithout expiry metadata for permanent grants.- Parameters:
holder- permission target; must not benull- Returns:
- immutable list of direct global permissions (may be empty)
- See Also:
-
shouldCreateUserRecords
Deprecated.Returns whether the engine should create user records automatically when unknown players are resolved.- Returns:
trueif new user records should be created (config-driven)- See Also:
-
getConfiguration
Deprecated.Returns the read-only PermissionsEx configuration view.- Returns:
- configuration instance
-
has
Deprecated.Checks whether the given online player holds a permission in their current world.- Parameters:
player- online playerpermission- permission node to check- Returns:
trueif granted,falseotherwise
-
has
Deprecated.Checks whether the given online player holds a permission in the named world.- Parameters:
player- online playerpermission- permission node to checkworld- world name- Returns:
trueif granted,falseotherwise
-
has
Deprecated.Checks whether the user identified by name holds a permission in the named world.Resolves offline and online users via the active backend. Returns
falsewhen the user cannot be resolved.- Parameters:
playerName- player name or UUID stringpermission- permission node to checkworld- world name, ornullfor global scope- Returns:
trueif granted,falseotherwise
-
has
Deprecated.Checks whether the user identified by UUID holds a permission in the named world.- Parameters:
playerId- player UUIDpermission- permission node to checkworld- world name, ornullfor global scope- Returns:
trueif granted,falseif denied or the user is unknown
-
getUser
Deprecated.Resolves or materializes aPermissionUserby identifier (UUID string or legacy name).- Parameters:
username- user identifier or display name- Returns:
- user instance
- Throws:
IllegalArgumentException- ifusernameis null or emptyIllegalStateException- if the user does not exist in the backend and cannot be created
-
cacheUser
Deprecated.Pre-caches a user during asynchronous login before the player is fully online.Thread-safe; stores the resolved user in the manager's in-memory cache using
identas key andfallbackNamefor UUID conversion fallbacks.- Parameters:
ident- stable user identifier (typically UUID string)fallbackName- player name used when converting legacy name-based records
-
getUser
Deprecated.Resolves or materializes aPermissionUserfor an online player.- Parameters:
player- online player- Returns:
- user instance
-
getUser
Deprecated.Resolves or materializes aPermissionUserby UUID.- Parameters:
uid- player UUID- Returns:
- user instance
-
getUsers
Deprecated.Returns all users known to the backend, materializing instances as needed.- Returns:
- unmodifiable set of users
-
getActiveUsers
Deprecated.Returns users currently held in the manager's in-memory cache.- Returns:
- copy of cached users (may be a subset of
getUsers())
-
getUserIdentifiers
Deprecated.Returns stable user identifiers stored in the backend.- Returns:
- collection of user identifiers (typically UUID strings)
-
getUserNames
Deprecated.Returns display names stored in the backend.- Returns:
- collection of user names
-
getUsers
Deprecated.Returns users that are direct members of the named group in the given world.Equivalent to
getUsers(String, String, boolean)withinheritance == false.- Parameters:
groupName- group identifierworldName- world name, ornullfor global scope- Returns:
- unmodifiable set of matching users
-
getUsers
Deprecated.Returns users that are direct members of the named group in global scope.Equivalent to
getUsers(String, boolean)withinheritance == false.- Parameters:
groupName- group identifier- Returns:
- unmodifiable set of matching users
-
getUsers
Deprecated.Returns users in the named group for the given world, optionally including descendant groups.- Parameters:
groupName- group identifierworldName- world name, ornullfor global scopeinheritance- whentrue, includes users in child/descendant groups- Returns:
- unmodifiable set of matching users
-
getUsers
Deprecated.Returns users in the named group across all worlds (including global scope), optionally including descendant groups.- Parameters:
groupName- group identifierinheritance- whentrue, includes users in child/descendant groups- Returns:
- unmodifiable set of matching users
-
resetUser
Deprecated.Removes the in-memoryPermissionUserfor the given identifier.Does not delete backend data; the next
getUser(String)reloads from storage. Differs fromclearUserCache(String), which retains the cached object and only clears resolved permission state.- Parameters:
userName- user identifier or name
-
resetUser
Deprecated.Removes the in-memoryPermissionUserfor the given player.- Parameters:
player- online player whose cached user object should be dropped- See Also:
-
clearUserCache
Deprecated.Clears resolved permission cache for the user identified by name without removing the cached user object.- Parameters:
userName- user identifier or name- See Also:
-
clearUserCache
Deprecated.Clears resolved permission cache for the user identified by UUID.- Parameters:
uid- player UUID- See Also:
-
clearUserCache
Deprecated.Clears resolved permission cache for the given online player.- Parameters:
player- online player- See Also:
-
getGroup
Deprecated.Resolves or materializes aPermissionGroupby name.- Parameters:
groupname- group identifier- Returns:
- group instance, or
nullifgroupnameis null or empty
-
getGroupList
Deprecated.Returns all groups known to the backend.- Returns:
- unmodifiable list of groups
-
getGroups
Deprecated.prefergetGroupList()Returns all groups as an array.- Returns:
- array of all groups
-
getGroupNames
Deprecated.prefer resolving groups viagetGroupList()or the backendReturns names of all groups in the backend.- Returns:
- collection of group names
-
getGroups
Deprecated.Returns child groups ofgroupNamein the given world (direct children only).Equivalent to
getGroups(String, String, boolean)withinheritance == false.- Parameters:
groupName- parent group identifierworldName- world name, ornullfor global scope- Returns:
- unmodifiable list of child groups
-
getGroups
Deprecated.Returns child groups ofgroupNamein global scope (direct children only).- Parameters:
groupName- parent group identifier- Returns:
- unmodifiable list of child groups
- See Also:
-
getGroups
@Deprecated List<PermissionGroup> getGroups(String groupName, String worldName, boolean inheritance) Deprecated.Returns child or descendant groups ofgroupNamein the given world.- Parameters:
groupName- parent group identifierworldName- world name, ornullfor global scopeinheritance- whentrue, includes all descendant groups; whenfalse, direct children only- Returns:
- unmodifiable list of matching groups
-
getGroups
Deprecated.Returns child or descendant groups ofgroupNameaggregated across all worlds and global scope.- Parameters:
groupName- parent group identifierinheritance- whentrue, includes all descendant groups; whenfalse, direct children only- Returns:
- unmodifiable, sorted list of matching groups
-
getDefaultGroups
Deprecated.Returns groups marked as default for the given world.Includes groups default in global scope (
worldName == nullon the group) when querying a specific world.- Parameters:
worldName- world name, ornullto query global defaults only- Returns:
- unmodifiable list of default groups (may be empty)
-
resetGroup
Deprecated.Removes the in-memoryPermissionGroupfor the given name.Does not delete backend data; the next
getGroup(String)reloads from storage.- Parameters:
groupName- group identifier- Returns:
- the removed cached group, or
nullif none was cached
-
setDebug
Deprecated.Enables or disables manager-wide debug logging.- Parameters:
debug-trueto enable debug output
-
isDebug
Deprecated.Returns whether manager-wide debug logging is enabled.- Returns:
trueif debug mode is active
-
getRankLadder
Deprecated.Returns groups on the named rank ladder keyed by rank number.- Parameters:
ladderName- ladder name (case-insensitive match)- Returns:
- map of rank to group; empty if the ladder does not exist
-
getWorldInheritance
Deprecated.Returns parent worlds from which the named world inherits permissions and options.- Parameters:
worldName- world name- Returns:
- ordered list of parent world names; empty if none configured
-
setWorldInheritance
Deprecated.Configures parent-world inheritance for the named world.Clears cached permission state on all active users after the change.
- Parameters:
world- world whose inheritance is being setparentWorlds- ordered list of parent world names
-
getBackend
Deprecated.Returns the active permission storage backend.- Returns:
- current
PermissionBackendinstance
-
setBackend
Deprecated.Switches the active backend to the named type, reloading data.- Parameters:
backendName- backend type identifier (e.g.file,sql)- Throws:
PermissionBackendException- if the backend cannot be created or initialized
-
createBackend
Deprecated.Creates a newPermissionBackendinstance without activating it.- Parameters:
backendName- backend type identifier- Returns:
- newly created backend
- Throws:
PermissionBackendException- if the backend cannot be created
-
reset
Deprecated.Clears all in-memory users and groups, reloads the active backend, and fires a reload event.- Throws:
PermissionBackendException- if the backend reload fails- See Also:
-
reset
Deprecated.Clears all in-memory users and groups and reloads the active backend.- Parameters:
callEvent- whentrue, publishes a system reload event after reload completes- Throws:
PermissionBackendException- if the backend reload fails
-
end
Deprecated.Shuts down the manager: closes the backend, clears caches, and stops the scheduler. -
initTimer
Deprecated.(Re)initializes the scheduled executor used for timed permission and timed group expiration.Called during startup and after
reset()cache clears. Tasks scheduled withTRANSIENT_PERMISSIONlifetime are not persisted. -
getPermissionMatcher
Deprecated.Returns the permission expression matcher used for node checks.- Returns:
- current
PermissionMatcher
-
setPermissionMatcher
Deprecated.Replaces the permission expression matcher.- Parameters:
matcher- new matcher implementation
-
getLogger
Deprecated.Returns the engine logger.- Returns:
- PermissionsEx logger instance
-
getExecutor
Deprecated.Returns the scheduled executor service used for timed tasks.- Returns:
- scheduler, or
nullafterend()
-
shouldSaveDefaultGroup
Deprecated.Returns whether default group membership should be persisted when saving users.- Returns:
trueif default groups are written to storage (config-driven)- See Also:
-
getGroupList()or the backend