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(); }