public interface TrackManager
Track instances.
All blocking methods return CompletableFutures, which will be
populated with the result once the data has been loaded/saved asynchronously.
Care should be taken when using such methods to ensure that the main server
thread is not blocked.
Methods such as CompletableFuture.get() and equivalent should
not be called on the main server thread. If you need to use
the result of these operations on the main server thread, register a
callback using CompletableFuture.thenAcceptAsync(Consumer, Executor).
| Modifier and Type | Method and Description |
|---|---|
@NonNull CompletableFuture<Track> |
createAndLoadTrack(@NonNull String name)
Creates a new track in the plugin's storage provider and then loads it
into memory.
|
@NonNull CompletableFuture<Void> |
deleteTrack(@NonNull Track track)
Permanently deletes a track from the plugin's storage provider.
|
@NonNull Set<Track> |
getLoadedTracks()
Gets a set of all loaded tracks.
|
@Nullable Track |
getTrack(@NonNull String name)
Gets a loaded track.
|
boolean |
isLoaded(@NonNull String name)
Check if a track is loaded in memory
|
@NonNull CompletableFuture<Void> |
loadAllTracks()
Loads all tracks into memory.
|
@NonNull CompletableFuture<Optional<Track>> |
loadTrack(@NonNull String name)
Loads a track from the plugin's storage provider into memory.
|
@NonNull CompletableFuture<Void> |
saveTrack(@NonNull Track track)
Saves a track's data back to the plugin's storage provider.
|
@NonNull CompletableFuture<Track> createAndLoadTrack(@NonNull String name)
If a track by the same name already exists, it will be loaded.
name - the name of the trackNullPointerException - if the name is null@NonNull CompletableFuture<Optional<Track>> loadTrack(@NonNull String name)
Returns an empty optional if the track does
not exist.
name - the name of the trackNullPointerException - if the name is null@NonNull CompletableFuture<Void> saveTrack(@NonNull Track track)
You should call this after you make any changes to a track.
track - the track to saveNullPointerException - if track is nullIllegalStateException - if the track instance was not obtained from LuckPerms.@NonNull CompletableFuture<Void> deleteTrack(@NonNull Track track)
track - the track to deleteNullPointerException - if track is nullIllegalStateException - if the track instance was not obtained from LuckPerms.@NonNull CompletableFuture<Void> loadAllTracks()
@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 nullboolean isLoaded(@NonNull String name)
name - the name to check forNullPointerException - if the name is null