Class BukkitFutureResult<T>
java.lang.Object
de.eldoria.eldoutilities.threading.futures.BukkitFutureResult<T>
- All Implemented Interfaces:
FutureResult<T>
-
Method Summary
Modifier and TypeMethodDescriptionasFuture()
Encapsulates thisFutureResult
as aCompletableFuture
.join()
Blocks the current thread until the action has completed.static <T> BukkitFutureResult<T>
of
(CompletableFuture<T> future) 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> throwableConsumer)
-
Method Details
-
of
-
whenComplete
Description copied from interface:FutureResult
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.
- Specified by:
whenComplete
in interfaceFutureResult<T>
- Parameters:
callback
- the callback
-
whenComplete
public void whenComplete(@NotNull @NotNull Consumer<? super T> callback, Consumer<Throwable> throwable) - Specified by:
whenComplete
in interfaceFutureResult<T>
-
whenComplete
public void whenComplete(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Consumer<? super T> callback, Consumer<Throwable> throwableConsumer) - Specified by:
whenComplete
in interfaceFutureResult<T>
-
whenComplete
public void whenComplete(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Consumer<? super T> callback) Description copied from interface:FutureResult
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.
- Specified by:
whenComplete
in interfaceFutureResult<T>
- Parameters:
plugin
- used for callback.callback
- the callback
-
join
Description copied from interface:FutureResult
Blocks the current thread until the action has completed.This method should only be called from an async task!
- Specified by:
join
in interfaceFutureResult<T>
- Returns:
- the result
-
asFuture
Description copied from interface:FutureResult
Encapsulates thisFutureResult
as aCompletableFuture
.- Specified by:
asFuture
in interfaceFutureResult<T>
- Returns:
- a future
-