Class Connection

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<Packet<?>>
net.minecraft.network.Connection
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler
Direct Known Subclasses:
FakePlayer.FakeConnection, RateKickingConnection

public class Connection extends io.netty.channel.SimpleChannelInboundHandler<Packet<?>>
  • Field Details

    • AVERAGE_PACKETS_SMOOTHING

      private static final float AVERAGE_PACKETS_SMOOTHING
      See Also:
    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • ROOT_MARKER

      public static final org.slf4j.Marker ROOT_MARKER
    • PACKET_MARKER

      public static final org.slf4j.Marker PACKET_MARKER
    • PACKET_RECEIVED_MARKER

      public static final org.slf4j.Marker PACKET_RECEIVED_MARKER
    • PACKET_SENT_MARKER

      public static final org.slf4j.Marker PACKET_SENT_MARKER
    • NETWORK_WORKER_GROUP

      public static final Supplier<io.netty.channel.nio.NioEventLoopGroup> NETWORK_WORKER_GROUP
    • NETWORK_EPOLL_WORKER_GROUP

      public static final Supplier<io.netty.channel.epoll.EpollEventLoopGroup> NETWORK_EPOLL_WORKER_GROUP
    • LOCAL_WORKER_GROUP

      public static final Supplier<io.netty.channel.DefaultEventLoopGroup> LOCAL_WORKER_GROUP
    • INITIAL_PROTOCOL

      private static final ProtocolInfo<ServerHandshakePacketListener> INITIAL_PROTOCOL
    • receiving

      private final PacketFlow receiving
    • sendLoginDisconnect

      private volatile boolean sendLoginDisconnect
    • pendingActions

      private final Queue<Consumer<Connection>> pendingActions
    • channel

      private io.netty.channel.Channel channel
    • address

      private SocketAddress address
    • disconnectListener

      @Nullable private volatile PacketListener disconnectListener
    • packetListener

      @Nullable private volatile PacketListener packetListener
    • disconnectionDetails

      @Nullable private DisconnectionDetails disconnectionDetails
    • encrypted

      private boolean encrypted
    • disconnectionHandled

      private boolean disconnectionHandled
    • receivedPackets

      private int receivedPackets
    • sentPackets

      private int sentPackets
    • averageReceivedPackets

      private float averageReceivedPackets
    • averageSentPackets

      private float averageSentPackets
    • tickCount

      private int tickCount
    • handlingFault

      private boolean handlingFault
    • delayedDisconnect

      @Nullable private volatile DisconnectionDetails delayedDisconnect
    • bandwidthDebugMonitor

      @Nullable BandwidthDebugMonitor bandwidthDebugMonitor
    • inboundProtocol

      @Nullable private ProtocolInfo<?> inboundProtocol
  • Constructor Details

    • Connection

      public Connection(PacketFlow p_129482_)
  • Method Details

    • channelActive

      public void channelActive(io.netty.channel.ChannelHandlerContext p_129525_) throws Exception
      Specified by:
      channelActive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelActive in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelInactive

      public void channelInactive(io.netty.channel.ChannelHandlerContext p_129527_)
      Specified by:
      channelInactive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelInactive in class io.netty.channel.ChannelInboundHandlerAdapter
    • exceptionCaught

      public void exceptionCaught(io.netty.channel.ChannelHandlerContext p_129533_, Throwable p_129534_)
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelHandler
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      exceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapter
    • channelRead0

      protected void channelRead0(io.netty.channel.ChannelHandlerContext p_129487_, Packet<?> p_129488_)
      Specified by:
      channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<Packet<?>>
    • genericsFtw

      private static <T extends PacketListener> void genericsFtw(Packet<T> p_129518_, PacketListener p_129519_)
    • validateListener

      private void validateListener(ProtocolInfo<?> p_320630_, PacketListener p_320459_)
    • syncAfterConfigurationChange

      private static void syncAfterConfigurationChange(io.netty.channel.ChannelFuture p_341671_)
    • setupInboundProtocol

      public <T extends PacketListener> void setupInboundProtocol(ProtocolInfo<T> p_320903_, T p_320940_)
    • setupOutboundProtocol

      public void setupOutboundProtocol(ProtocolInfo<?> p_319974_)
    • setListenerForServerboundHandshake

      public void setListenerForServerboundHandshake(PacketListener p_294829_)
    • initiateServerboundStatusConnection

      public void initiateServerboundStatusConnection(String p_294457_, int p_294964_, ClientStatusPacketListener p_295216_)
    • initiateServerboundPlayConnection

      public void initiateServerboundPlayConnection(String p_294126_, int p_296126_, ClientLoginPacketListener p_296049_)
    • initiateServerboundPlayConnection

      public <S extends ServerboundPacketListener, C extends ClientboundPacketListener> void initiateServerboundPlayConnection(String p_320416_, int p_320043_, ProtocolInfo<S> p_320648_, ProtocolInfo<C> p_320919_, C p_319801_, boolean p_319971_)
    • initiateServerboundConnection

      private <S extends ServerboundPacketListener, C extends ClientboundPacketListener> void initiateServerboundConnection(String p_294633_, int p_295471_, ProtocolInfo<S> p_320358_, ProtocolInfo<C> p_320237_, C p_320783_, ClientIntent p_294281_)
    • send

      public void send(Packet<?> p_129513_)
    • send

      public void send(Packet<?> p_243248_, @Nullable PacketSendListener p_243316_)
    • send

      public void send(Packet<?> p_295839_, @Nullable PacketSendListener p_294866_, boolean p_294265_)
    • runOnceConnected

      public void runOnceConnected(Consumer<Connection> p_294674_)
    • sendPacket

      private void sendPacket(Packet<?> p_129521_, @Nullable PacketSendListener p_243246_, boolean p_294510_)
    • doSendPacket

      private void doSendPacket(Packet<?> p_243260_, @Nullable PacketSendListener p_243290_, boolean p_294125_)
    • flushChannel

      public void flushChannel()
    • flush

      private void flush()
    • flushQueue

      private void flushQueue()
    • tick

      public void tick()
    • tickSecond

      protected void tickSecond()
    • getRemoteAddress

      public SocketAddress getRemoteAddress()
    • getLoggableAddress

      public String getLoggableAddress(boolean p_295875_)
    • disconnect

      public void disconnect(Component p_129508_)
    • disconnect

      public void disconnect(DisconnectionDetails p_350867_)
    • isMemoryConnection

      public boolean isMemoryConnection()
    • getReceiving

      public PacketFlow getReceiving()
    • getSending

      public PacketFlow getSending()
    • connectToServer

      public static Connection connectToServer(InetSocketAddress p_178301_, boolean p_178302_, @Nullable LocalSampleLogger p_324075_)
    • connect

      public static io.netty.channel.ChannelFuture connect(InetSocketAddress p_290034_, boolean p_290035_, Connection p_290031_)
    • outboundHandlerName

      private static String outboundHandlerName(boolean p_319809_)
    • inboundHandlerName

      private static String inboundHandlerName(boolean p_320267_)
    • configurePacketHandler

      public void configurePacketHandler(io.netty.channel.ChannelPipeline p_302007_)
    • configureSerialization

      public static void configureSerialization(io.netty.channel.ChannelPipeline p_265436_, PacketFlow p_265104_, boolean p_341592_, @Nullable BandwidthDebugMonitor p_299246_)
    • createFrameEncoder

      private static io.netty.channel.ChannelOutboundHandler createFrameEncoder(boolean p_341616_)
    • createFrameDecoder

      private static io.netty.channel.ChannelInboundHandler createFrameDecoder(@Nullable BandwidthDebugMonitor p_341605_, boolean p_341702_)
    • configureInMemoryPipeline

      public static void configureInMemoryPipeline(io.netty.channel.ChannelPipeline p_295541_, PacketFlow p_294540_)
    • connectToLocalServer

      public static Connection connectToLocalServer(SocketAddress p_129494_)
    • setEncryptionKey

      public void setEncryptionKey(Cipher p_129496_, Cipher p_129497_)
    • isEncrypted

      public boolean isEncrypted()
    • isConnected

      public boolean isConnected()
    • isConnecting

      public boolean isConnecting()
    • getPacketListener

      @Nullable public PacketListener getPacketListener()
    • getDisconnectionDetails

      @Nullable public DisconnectionDetails getDisconnectionDetails()
    • setReadOnly

      public void setReadOnly()
    • setupCompression

      public void setupCompression(int p_129485_, boolean p_182682_)
    • handleDisconnection

      public void handleDisconnection()
    • getAverageReceivedPackets

      public float getAverageReceivedPackets()
    • getAverageSentPackets

      public float getAverageSentPackets()
    • setBandwidthLogger

      public void setBandwidthLogger(LocalSampleLogger p_323799_)
    • channel

      public io.netty.channel.Channel channel()
    • getDirection

      public PacketFlow getDirection()
    • getInboundProtocol

      public ProtocolInfo<?> getInboundProtocol()