Interface Subscription

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Subscription
A handle to a registered listener that allows the registration to be cancelled.

Returned by MessageChannel.listen(dev.objz.commandbridge.api.message.MessageListener) and CommandBridgeAPI.onServerConnected(dev.objz.commandbridge.api.message.ServerEventListener). The caller is responsible for storing it and calling cancel() when the listener is no longer needed, for example during plugin shutdown.

Calling cancel() is idempotent: invoking it more than once has no effect.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Unregisters the associated listener so it receives no further events.
  • Method Details

    • cancel

      void cancel()
      Unregisters the associated listener so it receives no further events.

      This method is idempotent; subsequent calls after the first have no effect.