Interface LuckPerms
The API allows other plugins on the server to read and modify LuckPerms data, change behaviour of the plugin, listen to certain events, and integrate LuckPerms into other plugins and systems.
This interface represents the base of the API package. All functions are accessed via this interface.
To start using the API, you need to obtain an instance of this interface. These are registered by the LuckPerms plugin to the platforms Services Manager. This is the preferred method for obtaining an instance.
For ease of use, and for platforms without a Service Manager, an instance
can also be obtained from the static singleton accessor in
LuckPermsProvider.
-
Method Summary
Modifier and TypeMethodDescriptionGets theActionLogger, responsible for saving and broadcasting defined actions occurring on the platform.Gets theContextManager, responsible for managingContextCalculators, and calculating applicable contexts.Gets theEventBus, used for subscribing to internal LuckPerms events.Gets theGroupManager, responsible for managingGroupinstances.Gets theMessagingService, used to dispatch updates throughout a network of servers running the plugin.Gets theMetaStackFactory.Gets theNodeBuilderRegistry.Gets theNodeMatcherFactory.Gets thePlatform, which represents the server platform the plugin is running on.<T> @NonNull PlayerAdapter<T>getPlayerAdapter(@NonNull Class<T> playerClass) Gets thePlayerAdapterinstance, a utility class for adapting platform Player instances toUsers.Gets thePluginMetadata, responsible for providing metadata about the LuckPerms plugin currently running.Gets theQueryOptionsRegistry.Gets the name of this server.Gets theTrackManager, responsible for managingTrackinstances.Gets theUserManager, responsible for managingUserinstances.voidregisterMessengerProvider(@NonNull MessengerProvider messengerProvider) Registers aMessengerProviderfor use by the platform.Schedules the execution of an update task, and returns an encapsulation of the task as aCompletableFuture.
-
Method Details
-
getServerName
Gets the name of this server.This is defined in the LuckPerms configuration file, and is used for server specific permission handling.
The default server name is "global".
- Returns:
- the server name
-
getUserManager
@NonNull UserManager getUserManager()Gets theUserManager, responsible for managingUserinstances.This manager can be used to retrieve instances of
Userby uuid or name, or query all loaded users.- Returns:
- the user manager
-
getGroupManager
@NonNull GroupManager getGroupManager()Gets theGroupManager, responsible for managingGroupinstances.This manager can be used to retrieve instances of
Groupby name, or query all loaded groups.- Returns:
- the group manager
-
getTrackManager
@NonNull TrackManager getTrackManager()Gets theTrackManager, responsible for managingTrackinstances.This manager can be used to retrieve instances of
Trackby name, or query all loaded tracks.- Returns:
- the track manager
-
getPlayerAdapter
Gets thePlayerAdapterinstance, a utility class for adapting platform Player instances toUsers.The
playerClassparameter must be equal to the class or interface used by the server platform to represent players.Specifically:
org.bukkit.entity.Playernet.md_5.bungee.api.connection.ProxiedPlayerorg.spongepowered.api/entity.living.player.Playernet.minecraft.server.network.ServerPlayerEntity(Fabric)cn.nukkit.Playercom.velocitypowered.api.proxy.Player
- Type Parameters:
T- the player class type- Parameters:
playerClass- the class used by the platform to represent players- Returns:
- the player adapter
- Throws:
IllegalArgumentException- if the player class is not correct- Since:
- 5.1
-
getPlatform
Gets thePlatform, which represents the server platform the plugin is running on.- Returns:
- the platform
-
getPluginMetadata
@NonNull PluginMetadata getPluginMetadata()Gets thePluginMetadata, responsible for providing metadata about the LuckPerms plugin currently running.- Returns:
- the plugin metadata
-
getEventBus
Gets theEventBus, used for subscribing to internal LuckPerms events.- Returns:
- the event bus
-
getMessagingService
@NonNull Optional<MessagingService> getMessagingService()Gets theMessagingService, used to dispatch updates throughout a network of servers running the plugin.Not all instances of LuckPerms will have a messaging service setup and configured.
- Returns:
- the messaging service instance, if present.
-
getActionLogger
@NonNull ActionLogger getActionLogger()Gets theActionLogger, responsible for saving and broadcasting defined actions occurring on the platform.- Returns:
- the action logger
-
getContextManager
@NonNull ContextManager getContextManager()Gets theContextManager, responsible for managingContextCalculators, and calculating applicable contexts.- Returns:
- the context manager
-
getMetaStackFactory
@NonNull MetaStackFactory getMetaStackFactory()Gets theMetaStackFactory.The metastack factory provides methods for retrieving
MetaStackElements and constructingMetaStackDefinitions.- Returns:
- the meta stack factory
-
runUpdateTask
@NonNull CompletableFuture<Void> runUpdateTask()Schedules the execution of an update task, and returns an encapsulation of the task as aCompletableFuture.The exact actions performed in an update task remains an implementation detail of the plugin, however, as a minimum, it is expected to perform a full reload of user, group and track data, and ensure that any changes are fully applied and propagated.
- Returns:
- a future
-
registerMessengerProvider
Registers aMessengerProviderfor use by the platform.Note that the mere action of registering a provider doesn't necessarily mean that it will be used.
- Parameters:
messengerProvider- the messenger provider.
-
getNodeBuilderRegistry
Gets theNodeBuilderRegistry.- Returns:
- the node builder registry
-
getQueryOptionsRegistry
Gets theQueryOptionsRegistry.- Returns:
- the query options registry
- Since:
- 5.1
-
getNodeMatcherFactory
Gets theNodeMatcherFactory.- Returns:
- the node matcher factory
- Since:
- 5.1
-