Class Cotani

java.lang.Object
com.cotani.Cotani
All Implemented Interfaces:
AsyncCloseable, AutoCloseable

@NullMarked public final class Cotani extends Object implements AutoCloseable, AsyncCloseable
  • Method Details

    • forPlugin

      public static Cotani.Builder forPlugin(org.bukkit.plugin.Plugin plugin)
    • plugin

      public org.bukkit.plugin.Plugin plugin()
    • register

      public Cotani register(AutoCloseable closeable)
    • deregister

      public Cotani deregister(AutoCloseable closeable)
    • registerAsync

      public Cotani registerAsync(Supplier<CompletionStage<Void>> asyncCloseable)
    • deregisterAsync

      public Cotani deregisterAsync(Supplier<CompletionStage<Void>> asyncCloseable)
    • closeAsync

      public CompletionStage<Void> closeAsync()
      Executes resource teardown asynchronously.

      First, all registered asynchronous teardown stages are executed concurrently. Once completed, synchronous closeables are executed in reverse registration order.

      Specified by:
      closeAsync in interface AsyncCloseable
      Returns:
      a stage completing when all teardown steps finish
    • close

      public void close()
      Begins closing all registered resources without blocking the calling thread.

      Use closeAsync() when the caller needs to observe completion or failure.

      Specified by:
      close in interface AutoCloseable