Interface ChannelMessageSink

All Known Subinterfaces:
Player, RegisteredServer, ServerConnection

public interface ChannelMessageSink
Represents something that can be sent plugin messages.
  • Method Details

    • sendPluginMessage

      boolean sendPluginMessage(@NotNull @NotNull ChannelIdentifier identifier, byte @NotNull [] data)
      Sends a plugin message to this target.
      Parameters:
      identifier - the channel identifier to send the message on
      data - the data to send
      Returns:
      whether or not the message could be sent
    • sendPluginMessage

      @Experimental boolean sendPluginMessage(@NotNull @NotNull ChannelIdentifier identifier, @NotNull @NotNull PluginMessageEncoder dataEncoder)
      Sends a plugin message to this target.
         final ChannelMessageSink target;
         final ChannelIdentifier identifier;
         final boolean result = target.sendPluginMessage(identifier, (output) -> {
           output.writeUTF("some input");
           output.writeInt(1);
         });
       
      Parameters:
      identifier - the channel identifier to send the message on
      dataEncoder - the encoder of the data to be sent
      Returns:
      whether the message could be sent