Interface FutureResult<T>

All Known Implementing Classes:
BukkitFutureResult

public interface FutureResult<T>
  • Method Details

    • whenComplete

      void whenComplete(@NotNull @NotNull Consumer<? super T> callback)
      Attaches a completion callback to this FutureResult.

      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

      void whenComplete(@NotNull @NotNull Consumer<? super T> callback, Consumer<Throwable> throwable)
    • whenComplete

      void whenComplete(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull Consumer<? super T> callback, Consumer<Throwable> throwable)
    • whenComplete

      void whenComplete(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull Consumer<? super T> callback)
      Attaches a completion callback to this FutureResult.

      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

      @Nullable T 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 this FutureResult as a CompletableFuture.
      Returns:
      a future