Interface MessageChannel.Sender<P extends ChannelPayload>

Type Parameters:
P - the payload type
Enclosing interface:
MessageChannel<P extends ChannelPayload>

public static interface MessageChannel.Sender<P extends ChannelPayload>
A target-bound sender for dispatching payloads.
  • Method Details

    • send

      CompletableFuture<Void> send(P payload)
      Sends a payload without expecting a response.
      Parameters:
      payload - the data to send
      Returns:
      a future that completes when the message is dispatched
    • request

      CompletableFuture<P> request(P payload)
      Sends a request and waits for a response with the default timeout. Only supported for single-target senders.
      Parameters:
      payload - the request data
      Returns:
      a future containing the response payload
    • request

      CompletableFuture<P> request(P payload, Duration timeout)
      Sends a request and waits for a response with a custom timeout. Only supported for single-target senders.
      Parameters:
      payload - the request data
      timeout - the maximum time to wait for a response
      Returns:
      a future containing the response payload
    • requirePlayer

      default MessageChannel.Sender<P> requirePlayer(UUID player)
    • requirePlayer

      default MessageChannel.Sender<P> requirePlayer()
    • whenOnline

      default MessageChannel.Sender<P> whenOnline(UUID player)
    • whenOnline

      default MessageChannel.Sender<P> whenOnline()