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(String permission)
Returns a permission builder instance
|
default void |
cleanupUser(User user)
Unload a user from the internal storage, if they're not currently online.
|
ActionLogger |
getActionLogger()
Gets the
ActionLogger. |
LPConfiguration |
getConfiguration()
Gets a representation of the plugins configuration
|
default ContextSet |
getContextForPlayer(Object player)
Gets set of contexts applicable to a player using the platforms
ContextCalculators. |
default Optional<Contexts> |
getContextForUser(User user)
Gets a calculated context instance for the user using the rules of the platform.
|
ContextManager |
getContextManager()
Gets the
ContextManager. |
default Contexts |
getContextsForPlayer(Object player)
Gets a Contexts instance for the player using the platforms
ContextCalculators. |
EventBus |
getEventBus()
Gets the
EventBus, used for subscribing to internal LuckPerms
events. |
default Group |
getGroup(String name)
Gets a wrapped group object from the group storage
|
GroupManager |
getGroupManager()
Gets the
GroupManager, responsible for managing
Group instances. |
default Set<Group> |
getGroups()
Gets a set of all loaded groups.
|
default Optional<Group> |
getGroupSafe(String name)
Gets a wrapped group object from the group storage.
|
Optional<MessagingService> |
getMessagingService()
Gets the
MessagingService, if present. |
MetaStackFactory |
getMetaStackFactory()
Gets the
MetaStackFactory. |
NodeFactory |
getNodeFactory()
Gets the
NodeFactory. |
PlatformInfo |
getPlatformInfo()
Gets information about the platform LuckPerms is running on.
|
Storage |
getStorage()
Gets an object representing the plugins primary
Storage backend. |
default Track |
getTrack(String name)
Gets a wrapped track object from the track storage
|
TrackManager |
getTrackManager()
Gets the
TrackManager, responsible for managing
Track instances. |
default Set<Track> |
getTracks()
Gets a set of all loaded tracks.
|
default Optional<Track> |
getTrackSafe(String name)
Gets a wrapped track object from the track storage.
|
default User |
getUser(String name)
Gets a wrapped user object from the user storage
|
default User |
getUser(UUID uuid)
Gets a wrapped user object from the user storage
|
UserManager |
getUserManager()
Gets the
UserManager, responsible for managing
User instances. |
default Set<User> |
getUsers()
Gets a set of all loaded users.
|
default Optional<User> |
getUserSafe(String name)
Gets a wrapped user object from the user storage.
|
default Optional<User> |
getUserSafe(UUID uuid)
Gets a wrapped user object from the user storage.
|
UuidCache |
getUuidCache()
Deprecated.
this feature is now handled internally - and the API returns a
No-op implementation of this class.
|
default boolean |
isGroupLoaded(String name)
Check if a group is loaded in memory
|
default boolean |
isTrackLoaded(String name)
Check if a track is loaded in memory
|
default boolean |
isUserLoaded(UUID uuid)
Check if a user is loaded in memory
|
default LogEntry.Builder |
newLogEntryBuilder()
Returns a new LogEntry Builder instance
|
default void |
registerContextCalculator(ContextCalculator<?> calculator)
Register a custom context calculator to the server
|
void |
registerMessengerProvider(MessengerProvider messengerProvider)
Registers a
MessengerProvider for use by the platform. |
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.ActionLogger getActionLogger()
ActionLogger.
The action logger is responsible for saving and broadcasting defined actions occurring on the platform.
@Nonnull @Deprecated UuidCache getUuidCache()
UuidCache.
The uuid cache provides read access to the internal LuckPerms uuid mapping system.
ContextManager getContextManager()
ContextManager.
The context manager manages ContextCalculators, and calculates
applicable contexts for a given type.
@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.
@Nullable default 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 null@Nonnull default Optional<User> getUserSafe(@Nonnull UUID uuid)
uuid - the uuid of the user to getUser objectNullPointerException - if the uuid is null@Nullable default 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 null@Nonnull default 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 null@Nullable default 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 null@Nonnull default 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 null@Nullable default 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 null@Nonnull default 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 null@Nonnull default LogEntry.Builder newLogEntryBuilder()
@Nonnull 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.@Nonnull default 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 for@Nonnull default ContextSet getContextForPlayer(@Nonnull Object player)
ContextCalculators.player - the player to calculate for. Must be the player instance for the platform.@Nonnull default Contexts getContextsForPlayer(@Nonnull Object player)
ContextCalculators.player - the player to calculate for. Must be the player instance for the platform.Copyright © 2018. All rights reserved.