From 683e55c3a01f0c7df8108837ad5be493df4851db Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Sat, 1 Apr 2023 19:44:57 +0200 Subject: [PATCH] Don't use addFirst for the proxy handler --- .../proxy2server/Proxy2ServerChannelInitializer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/raphimc/viaproxy/proxy/proxy2server/Proxy2ServerChannelInitializer.java b/src/main/java/net/raphimc/viaproxy/proxy/proxy2server/Proxy2ServerChannelInitializer.java index 41ac9e8..a164a68 100644 --- a/src/main/java/net/raphimc/viaproxy/proxy/proxy2server/Proxy2ServerChannelInitializer.java +++ b/src/main/java/net/raphimc/viaproxy/proxy/proxy2server/Proxy2ServerChannelInitializer.java @@ -64,6 +64,10 @@ public class Proxy2ServerChannelInitializer extends MinecraftChannelInitializer new ProtocolPipelineImpl(user); ProxyConnection.fromChannel(channel).setUserConnection(user); + if (Options.PROXY_URL != null) { + channel.pipeline().addLast("viaproxy-proxy-handler", this.getProxyHandler()); + } + super.initChannel(channel); channel.attr(MCPipeline.PACKET_REGISTRY_ATTRIBUTE_KEY).set(PacketRegistryUtil.getHandshakeRegistry(true)); channel.pipeline().addBefore(MCPipeline.PACKET_CODEC_HANDLER_NAME, VPHPipeline.ENCODER_HANDLER_NAME, new VPHEncodeHandler(user)); @@ -75,10 +79,6 @@ public class Proxy2ServerChannelInitializer extends MinecraftChannelInitializer channel.pipeline().addBefore(MCPipeline.SIZER_HANDLER_NAME, VPHPipeline.PRE_NETTY_DECODER_HANDLER_NAME, new PreNettyDecoder(user)); } - if (Options.PROXY_URL != null) { - channel.pipeline().addFirst("viaproxy-proxy-handler", this.getProxyHandler()); - } - if (PluginManager.EVENT_MANAGER.call(new Proxy2ServerChannelInitializeEvent(ITyped.Type.POST, channel)).isCancelled()) { channel.close(); }