Class PluginMessageEvent

java.lang.Object
me.internalizable.numdrassl.api.event.connection.PluginMessageEvent

public final class PluginMessageEvent extends Object
Event fired when a plugin message is received from a backend server.

Plugin messages allow backend servers to communicate with the proxy through registered channels. This is commonly used for cross-server synchronization.

Example Usage

@Subscribe
public void onPluginMessage(PluginMessageEvent event) {
    if (event.getIdentifier().getId().equals("luckperms:data")) {
        byte[] data = event.getData();
        // Process the LuckPerms sync data

        // Mark as handled to prevent forwarding
        event.setResult(ForwardResult.handled());
    }
}
See Also:
  • Constructor Details

    • PluginMessageEvent

      public PluginMessageEvent(@Nonnull ChannelIdentifier identifier, @Nonnull Object source, @Nonnull byte[] data)
      Creates a new plugin message event.
      Parameters:
      identifier - the channel identifier
      source - the source (RegisteredServer or Player)
      data - the message data
  • Method Details

    • getIdentifier

      @Nonnull public ChannelIdentifier getIdentifier()
      Gets the channel identifier for this message.
      Returns:
      the channel identifier
    • getSource

      @Nonnull public Object getSource()
      Gets the source of this message.

      This can be either a RegisteredServer (if the message came from a backend) or a Player (if it came from a client).

      Returns:
      the message source
    • getData

      @Nonnull public byte[] getData()
      Gets the message data.
      Returns:
      the raw message bytes
    • getResult

      @Nonnull public PluginMessageEvent.ForwardResult getResult()
      Gets the forward result for this message.
      Returns:
      the forward result
    • setResult

      public void setResult(@Nonnull PluginMessageEvent.ForwardResult result)
      Sets whether this message should be forwarded.
      Parameters:
      result - the forward result