Interface ChannelMessageSink
- All Known Subinterfaces:
Player
,RegisteredServer
,ServerConnection
public interface ChannelMessageSink
Represents something that can be sent plugin messages.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
sendPluginMessage
(@NotNull ChannelIdentifier identifier, byte @NotNull [] data) Sends a plugin message to this target.boolean
sendPluginMessage
(@NotNull ChannelIdentifier identifier, @NotNull PluginMessageEncoder dataEncoder) Sends a plugin message to this target.
-
Method Details
-
sendPluginMessage
Sends a plugin message to this target.- Parameters:
identifier
- the channel identifier to send the message ondata
- 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 ondataEncoder
- the encoder of the data to be sent- Returns:
- whether the message could be sent
-