Class Connect

java.lang.Object
com.hypixel.hytale.protocol.packets.connection.Connect
All Implemented Interfaces:
Packet, ToServerPacket

public class Connect extends Object implements Packet, ToServerPacket
  • Field Details

    • PACKET_ID

      public static final int PACKET_ID
      See Also:
    • IS_COMPRESSED

      public static final boolean IS_COMPRESSED
      See Also:
    • NULLABLE_BIT_FIELD_SIZE

      public static final int NULLABLE_BIT_FIELD_SIZE
      See Also:
    • FIXED_BLOCK_SIZE

      public static final int FIXED_BLOCK_SIZE
      See Also:
    • VARIABLE_FIELD_COUNT

      public static final int VARIABLE_FIELD_COUNT
      See Also:
    • VARIABLE_BLOCK_START

      public static final int VARIABLE_BLOCK_START
      See Also:
    • MAX_SIZE

      public static final int MAX_SIZE
      See Also:
    • protocolCrc

      public int protocolCrc
    • protocolBuildNumber

      public int protocolBuildNumber
    • clientVersion

      @Nonnull public String clientVersion
    • clientType

      @Nonnull public ClientType clientType
    • identityToken

      @Nullable public String identityToken
    • language

      @Nonnull public String language
    • referralData

      @Nullable public byte[] referralData
    • referralSource

      @Nullable public HostAddress referralSource
  • Constructor Details

    • Connect

      public Connect()
    • Connect

      public Connect(int protocolCrc, int protocolBuildNumber, @Nonnull String clientVersion, @Nonnull ClientType clientType, @Nullable String identityToken, @Nonnull String language, @Nullable byte[] referralData, @Nullable HostAddress referralSource)
    • Connect

      public Connect(@Nonnull Connect other)
  • Method Details

    • getId

      public int getId()
      Description copied from interface: Packet
      Returns the unique packet ID.
      Specified by:
      getId in interface Packet
    • getChannel

      public NetworkChannel getChannel()
      Description copied from interface: Packet
      Returns the channel this packet should be sent on.
      Specified by:
      getChannel in interface Packet
    • requireBounds

      public static void requireBounds(MemorySegment mem, int offset)
      Checks that the fixed block fits. The per-field getters read without their own bound check, so call this once before reading fields out of an untrusted segment.
    • getProtocolCrc

      public static int getProtocolCrc(MemorySegment mem)
    • getProtocolCrc

      public static int getProtocolCrc(MemorySegment mem, int offset)
    • getProtocolBuildNumber

      public static int getProtocolBuildNumber(MemorySegment mem)
    • getProtocolBuildNumber

      public static int getProtocolBuildNumber(MemorySegment mem, int offset)
    • getClientVersion

      public static String getClientVersion(MemorySegment mem)
    • getClientVersion

      public static String getClientVersion(MemorySegment mem, int offset)
    • getClientType

      public static ClientType getClientType(MemorySegment mem)
    • getClientType

      public static ClientType getClientType(MemorySegment mem, int offset)
    • getIdentityToken

      @Nullable public static String getIdentityToken(MemorySegment mem)
    • getIdentityToken

      @Nullable public static String getIdentityToken(MemorySegment mem, int offset)
    • getLanguage

      public static String getLanguage(MemorySegment mem)
    • getLanguage

      public static String getLanguage(MemorySegment mem, int offset)
    • getReferralData

      @Nullable public static byte[] getReferralData(MemorySegment mem)
    • getReferralData

      @Nullable public static byte[] getReferralData(MemorySegment mem, int offset)
    • getReferralSource

      @Nullable public static HostAddress getReferralSource(MemorySegment mem)
    • getReferralSource

      @Nullable public static HostAddress getReferralSource(MemorySegment mem, int offset)
    • hasIdentityToken

      public static boolean hasIdentityToken(MemorySegment mem, int offset)
    • hasReferralData

      public static boolean hasReferralData(MemorySegment mem, int offset)
    • hasReferralSource

      public static boolean hasReferralSource(MemorySegment mem, int offset)
    • toObject

      public static Connect toObject(MemorySegment mem)
    • toObject

      public static Connect toObject(MemorySegment mem, int offset)
    • toObject

      public static Connect toObject(MemorySegment mem, int offset, @Nullable ReadCursor cursor)
      Decodes one Connect and reports the end of its encoding through the cursor. The variable block is decoded in field order against a running position, and each offset slot must name that position, so the fields decoded are the bytes walked.
    • serialize

      public int serialize(@Nonnull MemorySegment mem, int offset)
      Description copied from interface: Packet
      Writes this packet at offset and returns the number of bytes written, which callers rely on being exactly Packet.computeSize(). The framed write path reserves and length-prefixes on that figure before serializing, so a shorter or longer write corrupts the frame rather than failing.
      Specified by:
      serialize in interface Packet
    • computeSize

      public int computeSize()
      Description copied from interface: Packet
      Compute the exact number of bytes needed to serialize this packet.
      Specified by:
      computeSize in interface Packet
    • clone

      public Connect clone()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object