public 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.
| Modifier and Type | Method and Description |
|---|---|
@NonNull ActionLogger |
getActionLogger()
Gets the
ActionLogger, responsible for saving and broadcasting
defined actions occurring on the platform. |
@NonNull ContextManager |
getContextManager()
Gets the
ContextManager, responsible for managing
ContextCalculators, and calculating applicable contexts. |
@NonNull EventBus |
getEventBus()
Gets the
EventBus, used for subscribing to internal LuckPerms
events. |
@NonNull GroupManager |
getGroupManager()
Gets the
GroupManager, responsible for managing
Group instances. |
@NonNull Optional<MessagingService> |
getMessagingService()
Gets the
MessagingService, used to dispatch updates throughout a
network of servers running the plugin. |
@NonNull MetaStackFactory |
getMetaStackFactory()
Gets the
MetaStackFactory. |
@NonNull NodeBuilderRegistry |
getNodeBuilderRegistry()
Gets the
NodeBuilderRegistry. |
@NonNull NodeMatcherFactory |
getNodeMatcherFactory()
Gets the
NodeMatcherFactory. |
@NonNull Platform |
getPlatform()
Gets the
Platform, which represents the server platform the
plugin is running on. |
<T> @NonNull PlayerAdapter<T> |
getPlayerAdapter(@NonNull Class<T> playerClass)
Gets the
PlayerAdapter instance, a utility class for adapting platform Player
instances to Users. |
@NonNull PluginMetadata |
getPluginMetadata()
Gets the
PluginMetadata, responsible for providing metadata about
the LuckPerms plugin currently running. |
@NonNull QueryOptionsRegistry |
getQueryOptionsRegistry()
Gets the
QueryOptionsRegistry. |
@NonNull String |
getServerName()
Gets the name of this server.
|
@NonNull TrackManager |
getTrackManager()
Gets the
TrackManager, responsible for managing
Track instances. |
@NonNull UserManager |
getUserManager()
Gets the
UserManager, responsible for managing
User instances. |
void |
registerMessengerProvider(@NonNull MessengerProvider messengerProvider)
Registers a
MessengerProvider for use by the platform. |
@NonNull CompletableFuture<Void> |
runUpdateTask()
Schedules the execution of an update task, and returns an encapsulation
of the task as a
CompletableFuture. |
@NonNull String getServerName()
This is defined in the LuckPerms configuration file, and is used for server specific permission handling.
The default server name is "global".
@NonNull UserManager getUserManager()
UserManager, responsible for managing
User instances.
This manager can be used to retrieve instances of User by uuid
or name, or query all loaded users.
@NonNull GroupManager getGroupManager()
GroupManager, responsible for managing
Group instances.
This manager can be used to retrieve instances of Group by
name, or query all loaded groups.
@NonNull TrackManager getTrackManager()
TrackManager, responsible for managing
Track instances.
This manager can be used to retrieve instances of Track by
name, or query all loaded tracks.
<T> @NonNull PlayerAdapter<T> getPlayerAdapter(@NonNull Class<T> playerClass)
PlayerAdapter instance, a utility class for adapting platform Player
instances to Users.
The playerClass parameter 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.Playercn.nukkit.Playercom.velocitypowered.api.proxy.PlayerT - the player class typeplayerClass - the class used by the platform to represent playersIllegalArgumentException - if the player class is not correct@NonNull Platform getPlatform()
Platform, which represents the server platform the
plugin is running on.@NonNull PluginMetadata getPluginMetadata()
PluginMetadata, responsible for providing metadata about
the LuckPerms plugin currently running.@NonNull EventBus getEventBus()
EventBus, used for subscribing to internal LuckPerms
events.@NonNull Optional<MessagingService> getMessagingService()
MessagingService, 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.
@NonNull ActionLogger getActionLogger()
ActionLogger, responsible for saving and broadcasting
defined actions occurring on the platform.@NonNull ContextManager getContextManager()
ContextManager, responsible for managing
ContextCalculators, and calculating applicable contexts.@NonNull NodeBuilderRegistry getNodeBuilderRegistry()
NodeBuilderRegistry.@NonNull QueryOptionsRegistry getQueryOptionsRegistry()
QueryOptionsRegistry.@NonNull MetaStackFactory getMetaStackFactory()
MetaStackFactory.
The metastack factory provides methods for retrieving
MetaStackElements and constructing
MetaStackDefinitions.
@NonNull NodeMatcherFactory getNodeMatcherFactory()
NodeMatcherFactory.@NonNull CompletableFuture<Void> runUpdateTask()
CompletableFuture.
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.
void registerMessengerProvider(@NonNull MessengerProvider messengerProvider)
MessengerProvider for use by the platform.
Note that the mere action of registering a provider doesn't necessarily mean that it will be used.
messengerProvider - the messenger provider.