Class PlayerSetupConnectEvent

java.lang.Object
com.hypixel.hytale.server.core.event.events.player.PlayerSetupConnectEvent
All Implemented Interfaces:
IBaseEvent<Void>, ICancellable, IEvent<Void>

public class PlayerSetupConnectEvent extends Object implements IEvent<Void>, ICancellable
When a player enters the setup connection phase (after auth)
  • Field Details

    • DEFAULT_REASON

      public static final Message DEFAULT_REASON
  • Constructor Details

  • Method Details

    • getPacketHandler

      public PacketHandler getPacketHandler()
    • getUuid

      @Nonnull public UUID getUuid()
    • getUsername

      public String getUsername()
    • getAuth

      public PlayerAuthentication 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

      @Nullable public HostAddress 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

      @Nullable public ClientReferral getClientReferral()
      The client referral to send to the player.
      Returns:
      the client referral, or null to not refer
    • referToServer

      public void referToServer(@Nonnull String host, int port)
      Refers this player to another server, allowing server-to-server transfers with optional data.
      Parameters:
      host - the hostname/IP of the destination server
      port - the port of the destination server
    • referToServer

      public void referToServer(@Nonnull String host, int port, @Nullable byte[] data)
      Refers this player to another server, allowing server-to-server transfers with optional data.
      Parameters:
      host - the hostname/IP of the destination server
      port - the port of the destination server
      data - optional byte array data to send along with the referral (can be null, max 4KB)
      Throws:
      IllegalArgumentException - if data exceeds maximum size
    • getReason

      public Message getReason()
    • setReason

      public void setReason(Message reason)
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: ICancellable
      Determines whether this event has been cancelled.
      Specified by:
      isCancelled in interface ICancellable
      Returns:
      true if the event has been cancelled, false otherwise.
    • setCancelled

      public void setCancelled(boolean cancelled)
      Description copied from interface: ICancellable
      Called to set whether this event is cancelled.
      Specified by:
      setCancelled in interface ICancellable
      Parameters:
      cancelled - true to cancel the event, false to uncancel it.
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object