Class PermissionsManager
- Direct Known Subclasses:
BungeeCordDefaultHandler
,CloudNetPermissionsHandler
,LuckPermsManager
,SpigotPermissionsHandler
,VaultPermissionsSystem
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe handlerType field represents the type of permissions handler used by the PermissionsManager class. -
Constructor Summary
ConstructorsConstructorDescriptionPermissionsManager
(PermissionsHandlerType handlerType) The PermissionsManager class is responsible for managing permissions in the system. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull PermissionsManager
Retrieves the available PermissionsManager instance based on the available types.static @NotNull PermissionsManager
getHandler
(@NotNull PermissionsHandlerType type) Returns the PermissionsManager instance for the specified PermissionsHandlerType.abstract boolean
hasPermission
(String playername, String permission) This method checks if the specified player has the given permission.toString()
Returns a string representation of the PermissionsManager object.
-
Field Details
-
handlerType
The handlerType field represents the type of permissions handler used by the PermissionsManager class.The PermissionsHandlerType enum is used to identify and select the appropriate handler for managing permissions in the system. The handlerType field is an instance of the PermissionsHandlerType enum, which allows the system to identify and select the appropriate permissions handler.
The available types of permissions handlers are defined in the PermissionsHandlerType enum, which includes SPIGOT, LUCKPERMS, BUNGEECORD, CLOUDNET, and VAULT. The DEFAULT_PERMISSION_HANDLING type is also available as a fallback option.
Example usage:
PermissionsManager manager = new PermissionsManager(PermissionsHandlerType.SPIGOT); PermissionsHandlerType type = manager.getHandlerType(); if (type == PermissionsHandlerType.SPIGOT) { // SPIGOT handler code } else if (type == PermissionsHandlerType.LUCKPERMS) { // LUCKPERMS handler code } else if (type == PermissionsHandlerType.BUNGEECORD) { // BUNGEECORD handler code } else if (type == PermissionsHandlerType.CLOUDNET) { // CLOUDNET handler code } else if (type == PermissionsHandlerType.VAULT) { // VAULT handler code } else if (type == PermissionsHandlerType.DEFAULT_PERMISSION_HANDLING) { // DEFAULT_PERMISSION_HANDLING handler code }
For more information about each permissions handler type, refer to the documentation of the PermissionsHandlerType enum.
- See Also:
-
-
Constructor Details
-
PermissionsManager
The PermissionsManager class is responsible for managing permissions in the system. It uses different types of permissions handlers, defined by the PermissionsHandlerType enum, to perform various operations such as checking if a player has a permission.The PermissionsHandlerType enum represents the available types of permissions handlers. Each type is used to identify and select the appropriate handler for managing permissions.
- See Also:
-
-
Method Details
-
getHandler
@NotNull public static @NotNull PermissionsManager getHandler(@NotNull @NotNull PermissionsHandlerType type) throws PermissionManagerLoadException Returns the PermissionsManager instance for the specified PermissionsHandlerType.- Parameters:
type
- The type of permissions handler. Must not be null.- Returns:
- The PermissionsManager instance for the specified type.
- Throws:
PermissionManagerLoadException
- if there is an error loading the PermissionsManager.
-
getAvailableManager
Retrieves the available PermissionsManager instance based on the available types. If a suitable handler cannot be found, a default handler is returned based on the runtime environment.- Returns:
- The available PermissionsManager instance
- Throws:
PermissionManagerLoadException
- If there is an error loading the PermissionManager
-
hasPermission
This method checks if the specified player has the given permission.- Parameters:
playername
- The name of the player.permission
- The permission to check.- Returns:
- True if the player has the permission, false otherwise.
-
toString
Returns a string representation of the PermissionsManager object.This method overrides the toString() method from the Object class.
The string representation of the PermissionsManager object is "PermissionsManager{}".
-