Don't use addFirst for the proxy handler

This commit is contained in:
RaphiMC 2023-04-01 19:44:57 +02:00
parent de40ad3312
commit 683e55c3a0

View File

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