Record Class TransferMessage

java.lang.Object
java.lang.Record
me.internalizable.numdrassl.api.messaging.message.TransferMessage
Record Components:
sourceProxyId - the proxy initiating the transfer
timestamp - when the transfer was initiated
playerUuid - UUID of the player being transferred
playerName - username of the player being transferred
targetProxyId - the proxy that should receive the player
targetServer - the backend server to connect the player to
transferToken - optional security token for validating the transfer
All Implemented Interfaces:
ChannelMessage

public record TransferMessage(@Nonnull String sourceProxyId, @Nonnull Instant timestamp, @Nonnull UUID playerUuid, @Nonnull String playerName, @Nonnull String targetProxyId, @Nonnull String targetServer, @Nullable String transferToken) extends Record implements ChannelMessage
Player transfer coordination message between proxies.

Used to coordinate player transfers between proxy instances, enabling features like:

  • Cross-proxy server switching
  • Load balancing player distribution
  • Graceful proxy shutdown with player migration

Usage

// Initiate a transfer
TransferMessage transfer = new TransferMessage(
    proxyId, Instant.now(),
    playerUuid, playerName,
    targetProxyId, targetServer,
    generateTransferToken()
);
messaging.publish(Channels.TRANSFER, transfer);

// Subscribe to handle incoming transfers
@Subscribe(SystemChannel.TRANSFER)
public void onTransfer(TransferMessage transfer) {
    if (transfer.targetProxyId().equals(myProxyId)) {
        prepareForIncomingPlayer(transfer);
    }
}
  • Constructor Details

    • TransferMessage

      public TransferMessage(@Nonnull String sourceProxyId, @Nonnull Instant timestamp, @Nonnull UUID playerUuid, @Nonnull String playerName, @Nonnull String targetProxyId, @Nonnull String targetServer, @Nullable String transferToken)
      Creates an instance of a TransferMessage record class.
      Parameters:
      sourceProxyId - the value for the sourceProxyId record component
      timestamp - the value for the timestamp record component
      playerUuid - the value for the playerUuid record component
      playerName - the value for the playerName record component
      targetProxyId - the value for the targetProxyId record component
      targetServer - the value for the targetServer record component
      transferToken - the value for the transferToken record component
  • Method Details

    • messageType

      @Nonnull public String messageType()
      Description copied from interface: ChannelMessage
      Get the message type identifier for serialization.
      Specified by:
      messageType in interface ChannelMessage
      Returns:
      the message type (e.g., "heartbeat", "chat", "plugin")
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • sourceProxyId

      @Nonnull public String sourceProxyId()
      Returns the value of the sourceProxyId record component.
      Specified by:
      sourceProxyId in interface ChannelMessage
      Returns:
      the value of the sourceProxyId record component
    • timestamp

      @Nonnull public Instant timestamp()
      Returns the value of the timestamp record component.
      Specified by:
      timestamp in interface ChannelMessage
      Returns:
      the value of the timestamp record component
    • playerUuid

      @Nonnull public UUID playerUuid()
      Returns the value of the playerUuid record component.
      Returns:
      the value of the playerUuid record component
    • playerName

      @Nonnull public String playerName()
      Returns the value of the playerName record component.
      Returns:
      the value of the playerName record component
    • targetProxyId

      @Nonnull public String targetProxyId()
      Returns the value of the targetProxyId record component.
      Returns:
      the value of the targetProxyId record component
    • targetServer

      @Nonnull public String targetServer()
      Returns the value of the targetServer record component.
      Returns:
      the value of the targetServer record component
    • transferToken

      @Nullable public String transferToken()
      Returns the value of the transferToken record component.
      Returns:
      the value of the transferToken record component