Class PacketHandler

java.lang.Object
com.hypixel.hytale.server.core.io.PacketHandler
All Implemented Interfaces:
IPacketReceiver
Direct Known Subclasses:
GenericConnectionPacketHandler, GenericPacketHandler, InitialPacketHandler

public abstract class PacketHandler extends Object implements IPacketReceiver
  • Field Details

    • MAX_PACKET_ID

      public static final int MAX_PACKET_ID
      See Also:
    • LOGIN_TIMING_LOGGER

      private static final com.hypixel.hytale.logger.HytaleLogger LOGIN_TIMING_LOGGER
    • LOGIN_START_ATTRIBUTE_KEY

      private static final io.netty.util.AttributeKey<Long> LOGIN_START_ATTRIBUTE_KEY
    • channel

      @Nonnull protected final io.netty.channel.Channel channel
    • protocolVersion

      @Nonnull protected final ProtocolVersion protocolVersion
    • auth

      @Nullable protected PlayerAuthentication auth
    • queuePackets

      protected boolean queuePackets
    • queuedPackets

      protected final AtomicInteger queuedPackets
    • pingIdRandom

      protected final SecureRandom pingIdRandom
    • pingInfo

      @Nonnull protected final PacketHandler.PingInfo[] pingInfo
    • pingTimer

      private float pingTimer
    • registered

      protected boolean registered
    • timeoutTask

      private ScheduledFuture<?> timeoutTask
    • clientReadyForChunksFutureStack

      @Nullable protected Throwable clientReadyForChunksFutureStack
    • clientReadyForChunksFuture

      @Nullable protected CompletableFuture<Void> clientReadyForChunksFuture
    • disconnectReason

      @Nonnull protected final PacketHandler.DisconnectReason disconnectReason
  • Constructor Details

    • PacketHandler

      public PacketHandler(@Nonnull io.netty.channel.Channel channel, @Nonnull ProtocolVersion protocolVersion)
  • Method Details

    • getChannel

      @Nonnull public io.netty.channel.Channel getChannel()
    • setCompressionEnabled

      @Deprecated(forRemoval=true) public void setCompressionEnabled(boolean compressionEnabled)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • isCompressionEnabled

      @Deprecated(forRemoval=true) public boolean isCompressionEnabled()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getIdentifier

      @Nonnull public abstract String getIdentifier()
    • getProtocolVersion

      @Nonnull public ProtocolVersion getProtocolVersion()
    • registered

      public final void registered(@Nullable PacketHandler oldHandler)
    • registered0

      protected void registered0(@Nullable PacketHandler oldHandler)
    • unregistered

      public final void unregistered(@Nullable PacketHandler newHandler)
    • unregistered0

      protected void unregistered0(@Nullable PacketHandler newHandler)
    • handle

      public void handle(@Nonnull Packet packet)
    • accept

      public abstract void accept(@Nonnull Packet var1)
    • logCloseMessage

      public void logCloseMessage()
    • closed

      public void closed(io.netty.channel.ChannelHandlerContext ctx)
    • setQueuePackets

      public void setQueuePackets(boolean queuePackets)
    • tryFlush

      public void tryFlush()
    • write

      public void write(Packet... packets)
    • write

      public void write(@Nonnull Packet[] packets, @Nonnull Packet finalPacket)
    • write

      public void write(@Nonnull Packet packet)
      Specified by:
      write in interface IPacketReceiver
    • writeNoCache

      public void writeNoCache(@Nonnull Packet packet)
      Specified by:
      writeNoCache in interface IPacketReceiver
    • writePacket

      public void writePacket(@Nonnull Packet packet, boolean cache)
    • handleOutboundAndCachePackets

      private void handleOutboundAndCachePackets(@Nonnull Packet[] packets, @Nonnull Packet[] cachedPackets)
    • handleOutboundAndCachePacket

      @Nonnull private Packet handleOutboundAndCachePacket(@Nonnull Packet packet)
    • disconnect

      public void disconnect(@Nonnull String message)
    • disconnect0

      protected void disconnect0(@Nonnull String message)
    • getPacketStatsRecorder

      @Nullable public PacketStatsRecorder getPacketStatsRecorder()
    • getPingInfo

      @Nonnull public PacketHandler.PingInfo getPingInfo(@Nonnull PongType pongType)
    • getOperationTimeoutThreshold

      public long getOperationTimeoutThreshold()
    • tickPing

      public void tickPing(float dt)
    • sendPing

      public void sendPing()
    • handlePong

      public void handlePong(@Nonnull Pong packet)
    • setTimeout

      protected void setTimeout(@Nonnull String stageId, @Nonnull BooleanSupplier meets, long def, @Nonnull TimeUnit timeUnit)
    • clearTimeout

      protected void clearTimeout()
    • getAuth

      @Nullable public PlayerAuthentication getAuth()
    • stillActive

      public boolean stillActive()
    • getQueuedPacketsCount

      public int getQueuedPacketsCount()
    • isLocalConnection

      public boolean isLocalConnection()
    • isLANConnection

      public boolean isLANConnection()
    • getDisconnectReason

      @Nonnull public PacketHandler.DisconnectReason getDisconnectReason()
    • setClientReadyForChunksFuture

      public void setClientReadyForChunksFuture(@Nonnull CompletableFuture<Void> clientReadyFuture)
    • getClientReadyForChunksFuture

      @Nullable public CompletableFuture<Void> getClientReadyForChunksFuture()
    • logConnectionTimings

      public static void logConnectionTimings(@Nonnull io.netty.channel.Channel channel, @Nonnull String message, @Nonnull Level level)