Record Class TransferMessage
java.lang.Object
java.lang.Record
me.internalizable.numdrassl.api.messaging.message.TransferMessage
- Record Components:
sourceProxyId- the proxy initiating the transfertimestamp- when the transfer was initiatedplayerUuid- UUID of the player being transferredplayerName- username of the player being transferredtargetProxyId- the proxy that should receive the playertargetServer- the backend server to connect the player totransferToken- 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Get the message type identifier for serialization.Returns the value of theplayerNamerecord component.Returns the value of theplayerUuidrecord component.Returns the value of thesourceProxyIdrecord component.Returns the value of thetargetProxyIdrecord component.Returns the value of thetargetServerrecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetransferTokenrecord component.
-
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 aTransferMessagerecord class.- Parameters:
sourceProxyId- the value for thesourceProxyIdrecord componenttimestamp- the value for thetimestamprecord componentplayerUuid- the value for theplayerUuidrecord componentplayerName- the value for theplayerNamerecord componenttargetProxyId- the value for thetargetProxyIdrecord componenttargetServer- the value for thetargetServerrecord componenttransferToken- the value for thetransferTokenrecord component
-
-
Method Details
-
messageType
Description copied from interface:ChannelMessageGet the message type identifier for serialization.- Specified by:
messageTypein interfaceChannelMessage- Returns:
- the message type (e.g., "heartbeat", "chat", "plugin")
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
sourceProxyId
Returns the value of thesourceProxyIdrecord component.- Specified by:
sourceProxyIdin interfaceChannelMessage- Returns:
- the value of the
sourceProxyIdrecord component
-
timestamp
Returns the value of thetimestamprecord component.- Specified by:
timestampin interfaceChannelMessage- Returns:
- the value of the
timestamprecord component
-
playerUuid
Returns the value of theplayerUuidrecord component.- Returns:
- the value of the
playerUuidrecord component
-
playerName
Returns the value of theplayerNamerecord component.- Returns:
- the value of the
playerNamerecord component
-
targetProxyId
Returns the value of thetargetProxyIdrecord component.- Returns:
- the value of the
targetProxyIdrecord component
-
targetServer
Returns the value of thetargetServerrecord component.- Returns:
- the value of the
targetServerrecord component
-
transferToken
Returns the value of thetransferTokenrecord component.- Returns:
- the value of the
transferTokenrecord component
-