Contents
Class PlayerSetupConnectEvent
java.lang.Object
com.hypixel.hytale.server.core.event.events.player.PlayerSetupConnectEvent
- All Implemented Interfaces:
IBaseEvent<Void>, ICancellable, IEvent<Void>
When a player enters the setup connection phase (after auth)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPlayerSetupConnectEvent(PacketHandler packetHandler, String username, UUID uuid, PlayerAuthentication auth, byte[] referralData, HostAddress referralSource) -
Method Summary
Modifier and TypeMethodDescriptiongetAuth()The client referral to send to the player.byte[]Gets the referral data sent during server transfer, if any.Gets the source server that referred this player (for abuse detection).getUuid()booleanDetermines whether this event has been cancelled.booleanCheck if this is a referral connection (player transferred from another server).voidreferToServer(String host, int port) Refers this player to another server, allowing server-to-server transfers with optional data.voidreferToServer(String host, int port, byte[] data) Refers this player to another server, allowing server-to-server transfers with optional data.voidsetCancelled(boolean cancelled) Called to set whether this event is cancelled.voidtoString()
-
Field Details
-
DEFAULT_REASON
-
-
Constructor Details
-
PlayerSetupConnectEvent
public PlayerSetupConnectEvent(PacketHandler packetHandler, String username, @Nonnull UUID uuid, PlayerAuthentication auth, byte[] referralData, HostAddress referralSource)
-
-
Method Details
-
getPacketHandler
-
getUuid
-
getUsername
-
getAuth
-
getReferralData
@Nullable public byte[] getReferralData()Gets the referral data sent during server transfer, if any.WARNING: In DevelopmentConnect mode (unauthenticated), this data is UNTRUSTED! Plugins MUST validate referral data before using it.
- Returns:
- the referral data, or null if not a referral connection
-
isReferralConnection
public boolean isReferralConnection()Check if this is a referral connection (player transferred from another server).- Returns:
- true if referral data is present
-
getReferralSource
Gets the source server that referred this player (for abuse detection).This is the server the player was connected to before being transferred. Use this to validate referrals, detect abuse, and implement server trust lists.
- Returns:
- the source server address, or null if not a referral or source not provided
-
getClientReferral
The client referral to send to the player.- Returns:
- the client referral, or null to not refer
-
referToServer
Refers this player to another server, allowing server-to-server transfers with optional data.- Parameters:
host- the hostname/IP of the destination serverport- the port of the destination server
-
referToServer
Refers this player to another server, allowing server-to-server transfers with optional data.- Parameters:
host- the hostname/IP of the destination serverport- the port of the destination serverdata- optional byte array data to send along with the referral (can be null, max 4KB)- Throws:
IllegalArgumentException- if data exceeds maximum size
-
getReason
-
setReason
-
isCancelled
public boolean isCancelled()Description copied from interface:ICancellableDetermines whether this event has been cancelled.- Specified by:
isCancelledin interfaceICancellable- Returns:
trueif the event has been cancelled,falseotherwise.
-
setCancelled
public void setCancelled(boolean cancelled) Description copied from interface:ICancellableCalled to set whether this event is cancelled.- Specified by:
setCancelledin interfaceICancellable- Parameters:
cancelled-trueto cancel the event,falseto uncancel it.
-
toString
-