public interface UserManager
User instances.
Note that User instances are automatically loaded for online players. It's likely that offline players will not have an instance pre-loaded.
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupUser(User user)
Unload a user from the internal storage, if they're not currently online.
|
Set<User> |
getLoadedUsers()
Gets a set of all loaded users.
|
User |
getUser(String name)
Gets a loaded user.
|
User |
getUser(UUID uuid)
Gets a loaded user.
|
default Optional<User> |
getUserOpt(String name)
Gets a loaded user.
|
default Optional<User> |
getUserOpt(UUID uuid)
Gets a loaded user.
|
boolean |
isLoaded(UUID uuid)
Check if a user is loaded in memory
|
default CompletableFuture<User> |
loadUser(UUID uuid)
Loads a user from the plugin's storage provider into memory.
|
CompletableFuture<User> |
loadUser(UUID uuid,
String username)
Loads a user from the plugin's storage provider into memory.
|
CompletableFuture<Void> |
saveUser(User user)
Saves a user's data back to the plugin's storage provider.
|
@Nonnull CompletableFuture<User> loadUser(@Nonnull UUID uuid, @Nullable String username)
This method is effectively the same as
Storage.loadUser(UUID, String), however, the Future returns the
resultant user instance instead of a boolean flag.
Unlike the method in Storage, when a user cannot be loaded,
the future will be completed exceptionally.
uuid - the uuid of the userusername - the username, if knownNullPointerException - if the uuid is null@Nonnull default CompletableFuture<User> loadUser(@Nonnull UUID uuid)
This method is effectively the same as Storage.loadUser(UUID),
however, the Future returns the resultant user instance instead of a
boolean flag.
Unlike the method in Storage, when a user cannot be loaded,
the future will be completed exceptionally.
uuid - the uuid of the userNullPointerException - if the uuid is null@Nonnull CompletableFuture<Void> saveUser(@Nonnull User user)
You should call this after you make any changes to a user.
This method is effectively the same as Storage.saveUser(User),
however, the Future returns void instead of a boolean flag.
Unlike the method in Storage, when a user cannot be saved,
the future will be completed exceptionally.
user - the user to saveNullPointerException - if user is nullIllegalStateException - if the user instance was not obtained from LuckPerms.@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 null@Nonnull default Optional<User> getUserOpt(@Nonnull UUID uuid)
uuid - the uuid of the user to getUser objectNullPointerException - if the uuid is null@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 null@Nonnull default Optional<User> getUserOpt(@Nonnull String name)
name - the username of the user to getUser objectNullPointerException - if the name is nullboolean isLoaded(@Nonnull UUID uuid)
uuid - the uuid to check forNullPointerException - if the uuid is nullvoid cleanupUser(@Nonnull User user)
user - the user to unloadNullPointerException - if the user is nullCopyright © 2018. All rights reserved.