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