Interface LuckPerms


public interface LuckPerms
The LuckPerms API.

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 Details

    • getServerName

      @NonNull String 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 the 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.

      Returns:
      the user manager
    • getGroupManager

      @NonNull GroupManager getGroupManager()
      Gets the GroupManager, responsible for managing Group instances.

      This manager can be used to retrieve instances of Group by name, or query all loaded groups.

      Returns:
      the group manager
    • getTrackManager

      @NonNull TrackManager getTrackManager()
      Gets the TrackManager, responsible for managing Track instances.

      This manager can be used to retrieve instances of Track by name, or query all loaded tracks.

      Returns:
      the track manager
    • getPlayerAdapter

      <T> @NonNull PlayerAdapter<T> getPlayerAdapter(@NonNull Class<T> playerClass)
      Gets the 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.Player
      • net.md_5.bungee.api.connection.ProxiedPlayer
      • org.spongepowered.api/entity.living.player.Player
      • net.minecraft.server.network.ServerPlayerEntity (Fabric)
      • cn.nukkit.Player
      • com.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

      @NonNull Platform getPlatform()
      Gets the Platform, which represents the server platform the plugin is running on.
      Returns:
      the platform
    • getPluginMetadata

      @NonNull PluginMetadata getPluginMetadata()
      Gets the PluginMetadata, responsible for providing metadata about the LuckPerms plugin currently running.
      Returns:
      the plugin metadata
    • getEventBus

      @NonNull EventBus getEventBus()
      Gets the EventBus, used for subscribing to internal LuckPerms events.
      Returns:
      the event bus
    • getMessagingService

      @NonNull Optional<MessagingService> getMessagingService()
      Gets the 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.

      Returns:
      the messaging service instance, if present.
    • getActionLogger

      @NonNull ActionLogger getActionLogger()
      Gets the ActionLogger, responsible for saving and broadcasting defined actions occurring on the platform.
      Returns:
      the action logger
    • getContextManager

      @NonNull ContextManager getContextManager()
      Gets the ContextManager, responsible for managing ContextCalculators, and calculating applicable contexts.
      Returns:
      the context manager
    • getMetaStackFactory

      @NonNull MetaStackFactory getMetaStackFactory()
      Gets the MetaStackFactory.

      The metastack factory provides methods for retrieving MetaStackElements and constructing MetaStackDefinitions.

      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 a 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.

      Returns:
      a future
    • registerMessengerProvider

      void registerMessengerProvider(@NonNull MessengerProvider messengerProvider)
      Registers a MessengerProvider for 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

      @Internal @NonNull NodeBuilderRegistry getNodeBuilderRegistry()
      Returns:
      the node builder registry
    • getQueryOptionsRegistry

      @Internal @NonNull QueryOptionsRegistry getQueryOptionsRegistry()
      Returns:
      the query options registry
      Since:
      5.1
    • getNodeMatcherFactory

      @Internal @NonNull NodeMatcherFactory getNodeMatcherFactory()
      Returns:
      the node matcher factory
      Since:
      5.1