Interface FutureResult<T>
- All Known Implementing Classes:
BukkitFutureResult
public interface FutureResult<T>
-
Method Summary
Modifier and TypeMethodDescriptionasFuture()
Encapsulates thisFutureResult
as aCompletableFuture
.join()
Blocks the current thread until the action has completed.void
whenComplete
(@NotNull Consumer<? super T> callback) Attaches a completion callback to thisFutureResult
.void
void
Attaches a completion callback to thisFutureResult
.void
whenComplete
(@NotNull Plugin plugin, @NotNull Consumer<? super T> callback, Consumer<Throwable> throwable)
-
Method Details
-
whenComplete
Attaches a completion callback to thisFutureResult
.If the action is already complete, the runnable will be called immediately.
If it is not complete, the consumer will be called synchronously using the Bukkit scheduler when the action is completed.
- Parameters:
callback
- the callback
-
whenComplete
-
whenComplete
-
whenComplete
Attaches a completion callback to thisFutureResult
.If the action is already complete, the runnable will be called immediately.
If it is not complete, the consumer will be called synchronously using the Bukkit scheduler when the action is completed.
- Parameters:
plugin
- used for callback.callback
- the callback
-
join
Blocks the current thread until the action has completed.This method should only be called from an async task!
- Returns:
- the result
-
asFuture
Encapsulates thisFutureResult
as aCompletableFuture
.- Returns:
- a future
-