public interface LuckPermsApi
This interface is the base of the entire API package. All API functions are accessed via this interface.
An instance can be obtained via LuckPerms.getApi(), or the platforms
Services Manager.
| Modifier and Type | Method and Description |
|---|---|
default Node.Builder |
buildNode(@NonNull String permission)
Returns a permission builder instance
|
default void |
cleanupUser(@NonNull User user)
Unload a user from the internal storage, if they're not currently online.
|
@NonNull ActionLogger |
getActionLogger()
Gets the
ActionLogger. |
@NonNull LPConfiguration |
getConfiguration()
Gets a representation of the plugins configuration
|
default @NonNull ContextSet |
getContextForPlayer(@NonNull Object player)
Gets set of contexts applicable to a player using the platforms
ContextCalculators. |
default @NonNull Optional<Contexts> |
getContextForUser(@NonNull User user)
Gets a calculated context instance for the user using the rules of the platform.
|
@NonNull ContextManager |
getContextManager()
Gets the
ContextManager. |
default @NonNull Contexts |
getContextsForPlayer(@NonNull Object player)
Gets a Contexts instance for the player using the platforms
ContextCalculators. |
@NonNull EventBus |
getEventBus()
Gets the
EventBus, used for subscribing to internal LuckPerms
events. |
default @Nullable Group |
getGroup(@NonNull String name)
Gets a wrapped group object from the group storage
|
@NonNull GroupManager |
getGroupManager()
Gets the
GroupManager, responsible for managing
Group instances. |
default @NonNull Set<Group> |
getGroups()
Gets a set of all loaded groups.
|
default @NonNull Optional<Group> |
getGroupSafe(@NonNull String name)
Gets a wrapped group object from the group storage.
|
@NonNull Collection<String> |
getKnownPermissions()
Gets a
Collection of all known permission strings. |
@NonNull Optional<MessagingService> |
getMessagingService()
Gets the
MessagingService, if present. |
@NonNull MetaStackFactory |
getMetaStackFactory()
Gets the
MetaStackFactory. |
@NonNull NodeFactory |
getNodeFactory()
Gets the
NodeFactory. |
@NonNull PlatformInfo |
getPlatformInfo()
Gets information about the platform LuckPerms is running on.
|
@NonNull Storage |
getStorage()
Gets an object representing the plugins primary
Storage backend. |
default @Nullable Track |
getTrack(@NonNull String name)
Gets a wrapped track object from the track storage
|
@NonNull TrackManager |
getTrackManager()
Gets the
TrackManager, responsible for managing
Track instances. |
default @NonNull Set<Track> |
getTracks()
Gets a set of all loaded tracks.
|
default @NonNull Optional<Track> |
getTrackSafe(@NonNull String name)
Gets a wrapped track object from the track storage.
|
default @Nullable User |
getUser(@NonNull String name)
Gets a wrapped user object from the user storage
|
default @Nullable User |
getUser(@NonNull UUID uuid)
Gets a wrapped user object from the user storage
|
@NonNull UserManager |
getUserManager()
Gets the
UserManager, responsible for managing
User instances. |
default @NonNull Set<User> |
getUsers()
Gets a set of all loaded users.
|
default @NonNull Optional<User> |
getUserSafe(@NonNull String name)
Gets a wrapped user object from the user storage.
|
default @NonNull Optional<User> |
getUserSafe(@NonNull UUID uuid)
Gets a wrapped user object from the user storage.
|
@NonNull UuidCache |
getUuidCache()
Deprecated.
this feature is now handled internally - and the API returns a
No-op implementation of this class.
|
default boolean |
isGroupLoaded(@NonNull String name)
Check if a group is loaded in memory
|
default boolean |
isTrackLoaded(@NonNull String name)
Check if a track is loaded in memory
|
default boolean |
isUserLoaded(@NonNull UUID uuid)
Check if a user is loaded in memory
|
default LogEntry.Builder |
newLogEntryBuilder()
Returns a new LogEntry Builder instance
|
default void |
registerContextCalculator(@NonNull ContextCalculator<?> calculator)
Register a custom context calculator to the server
|
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 PlatformInfo getPlatformInfo()
@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.
The storage instance should be used to
load/create/save 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.
The storage instance should be used to
load/create/save/delete 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.
The storage instance should be used to
load/create/save/delete tracks.
@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.
@NonNull EventBus getEventBus()
EventBus, used for subscribing to internal LuckPerms
events.@NonNull LPConfiguration getConfiguration()
@NonNull Storage getStorage()
Storage backend.
The instance propagates calls to the internal DAO (Data Access Object), and applies any changes to the storage provider.
@NonNull Optional<MessagingService> getMessagingService()
MessagingService, if present.
The MessagingService is 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, but it is recommended that all users of the API account for and make use of this.
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.@NonNull ActionLogger getActionLogger()
ActionLogger.
The action logger is responsible for saving and broadcasting defined actions occurring on the platform.
@Deprecated @NonNull UuidCache getUuidCache()
UuidCache.
The uuid cache provides read access to the internal LuckPerms uuid mapping system.
@NonNull ContextManager getContextManager()
ContextManager.
The context manager manages ContextCalculators, and calculates
applicable contexts for a given type.
@NonNull Collection<String> getKnownPermissions()
Collection of all known permission strings.@NonNull NodeFactory getNodeFactory()
NodeFactory.
The node factory provides methods for building Node instances.
@NonNull MetaStackFactory getMetaStackFactory()
MetaStackFactory.
The metastack factory provides methods for retrieving
MetaStackElements and constructing
MetaStackDefinitions.
default @Nullable User getUser(@NonNull UUID uuid)
uuid - the uuid of the user to getUser object, if one matching the uuid is loaded, or null if notNullPointerException - if the uuid is nulldefault @NonNull Optional<User> getUserSafe(@NonNull UUID uuid)
uuid - the uuid of the user to getUser objectNullPointerException - if the uuid is nulldefault @Nullable User getUser(@NonNull String name)
name - the username of the user to getUser object, if one matching the uuid is loaded, or null if notNullPointerException - if the name is nulldefault @NonNull Optional<User> getUserSafe(@NonNull String name)
name - the username of the user to getUser objectNullPointerException - if the name is nulldefault boolean isUserLoaded(@NonNull UUID uuid)
uuid - the uuid to check forNullPointerException - if the uuid is nulldefault void cleanupUser(@NonNull User user)
user - the user to unloadNullPointerException - if the user is nulldefault @Nullable Group getGroup(@NonNull String name)
name - the name of the group to getGroup object, if one matching the name exists, or null if notNullPointerException - if the name is nulldefault @NonNull Optional<Group> getGroupSafe(@NonNull String name)
This method does not return null, unlike getGroup(java.lang.String)
name - the name of the group to getGroup objectNullPointerException - if the name is nulldefault boolean isGroupLoaded(@NonNull String name)
name - the name to check forNullPointerException - if the name is nulldefault @Nullable Track getTrack(@NonNull String name)
name - the name of the track to getTrack object, if one matching the name exists, or null
if notNullPointerException - if the name is nulldefault @NonNull Optional<Track> getTrackSafe(@NonNull String name)
This method does not return null, unlike getTrack(java.lang.String)
name - the name of the track to getTrack objectNullPointerException - if the name is nulldefault boolean isTrackLoaded(@NonNull String name)
name - the name to check forNullPointerException - if the name is nulldefault LogEntry.Builder newLogEntryBuilder()
default Node.Builder buildNode(@NonNull String permission) throws IllegalArgumentException
permission - the main permission node to buildNode.Builder instanceIllegalArgumentException - if the permission is invalidNullPointerException - if the permission is nulldefault void registerContextCalculator(@NonNull ContextCalculator<?> calculator)
calculator - the context calculator to register. The type MUST be the player class of the platform.ClassCastException - if the type is not the player class of the platform.default @NonNull Optional<Contexts> getContextForUser(@NonNull User user)
These values are calculated using the options in the configuration, and the provided calculators.
user - the user to get contexts fordefault @NonNull ContextSet getContextForPlayer(@NonNull Object player)
ContextCalculators.player - the player to calculate for. Must be the player instance for the platform.default @NonNull Contexts getContextsForPlayer(@NonNull Object player)
ContextCalculators.player - the player to calculate for. Must be the player instance for the platform.