Class PermissionManager
java.lang.Object
com.github.darksoulq.abyssallib.server.permission.PermissionManager
The central authority for managing permissions within AbyssalLib.
This manager handles player join/quit cycles, synchronizes internal permission states with the Bukkit engine, and manages persistent storage operations.
-
Constructor Summary
ConstructorsConstructorDescriptionPermissionManager(org.bukkit.plugin.Plugin plugin, PermissionStorage storage) Constructs a new PermissionManager and initializes storage systems. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteGroup(String id) Deletes a group and removes it from all active holders.Gets all known users from the storage backend.getLoadedUser(UUID uuid) Retrieves a user from memory only.Gets the storage implementation.Retrieves a user from the cache or loads them from storage.getUuidFromName(String name) Resolves aUUIDfrom a username.voidhandleJoin(org.bukkit.entity.Player player) Processes player join logic, updating names and syncing permissions.voidhandleQuit(org.bukkit.entity.Player player) Processes player quit logic, cleaning up memory and attachments.voidInvalidates the calculated permission cache for all loaded users.static booleanisValidNode(String node) Validates if a permission string is a valid or recognized node.voidsaveGroup(PermissionGroup group) Persists a group asynchronously.voidsaveUser(PermissionUser user) Persists a user asynchronously.voidshutdown()Performs a graceful shutdown, saving all data synchronously.voidupdatePlayer(UUID uuid) Synchronizes internal permission states with the Bukkit engine for a player.
-
Constructor Details
-
PermissionManager
Constructs a new PermissionManager and initializes storage systems.- Parameters:
plugin- The owning plugin.storage- The storage backend to use.
-
-
Method Details
-
getStorage
Gets the storage implementation.- Returns:
- The current
PermissionStorage.
-
isValidNode
Validates if a permission string is a valid or recognized node.- Parameters:
node- The permission string to validate.- Returns:
trueif the node is valid,falseotherwise.
-
getUser
Retrieves a user from the cache or loads them from storage.- Parameters:
uuid- TheUUIDof the user.- Returns:
- The
PermissionUserinstance.
-
getLoadedUser
Retrieves a user from memory only.- Parameters:
uuid- TheUUIDof the user.- Returns:
- The user, or
nullif not loaded.
-
getKnownUsers
-
getUuidFromName
-
saveUser
Persists a user asynchronously.- Parameters:
user- ThePermissionUserto save.
-
saveGroup
Persists a group asynchronously.- Parameters:
group- ThePermissionGroupto save.
-
deleteGroup
Deletes a group and removes it from all active holders.- Parameters:
id- The ID of the group to delete.
-
handleJoin
public void handleJoin(org.bukkit.entity.Player player) Processes player join logic, updating names and syncing permissions.- Parameters:
player- The joiningPlayer.
-
handleQuit
public void handleQuit(org.bukkit.entity.Player player) Processes player quit logic, cleaning up memory and attachments.- Parameters:
player- The quittingPlayer.
-
updatePlayer
-
invalidateAllUsers
public void invalidateAllUsers()Invalidates the calculated permission cache for all loaded users. -
shutdown
public void shutdown()Performs a graceful shutdown, saving all data synchronously.
-