Fixed legacy passthrough

This commit is contained in:
RaphiMC 2023-10-03 18:44:21 +02:00
parent e461ef165e
commit 58b4819677
No known key found for this signature in database
GPG key ID: 0F6BB0657A03AC94
2 changed files with 8 additions and 4 deletions

View file

@ -40,6 +40,7 @@ public class PassthroughClient2ProxyChannelInitializer extends Client2ProxyChann
return;
}
channel.pipeline().addLast(MCPipeline.FLOW_CONTROL_HANDLER_NAME, MCPipeline.FLOW_CONTROL_HANDLER.get());
channel.pipeline().addLast(MCPipeline.HANDLER_HANDLER_NAME, this.handlerSupplier.get());
if (PluginManager.EVENT_MANAGER.call(new Client2ProxyChannelInitializeEvent(ITyped.Type.POST, channel, true)).isCancelled()) {

View file

@ -38,6 +38,13 @@ public class PassthroughClient2ProxyHandler extends SimpleChannelInboundHandler<
private LegacyProxyConnection proxyConnection;
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
super.channelActive(ctx);
this.connectToServer(ctx.channel());
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
super.channelInactive(ctx);
@ -55,10 +62,6 @@ public class PassthroughClient2ProxyHandler extends SimpleChannelInboundHandler<
if (!ctx.channel().isOpen()) return;
if (!msg.isReadable()) return;
if (this.proxyConnection == null) {
this.connectToServer(ctx.channel());
}
this.proxyConnection.getChannel().writeAndFlush(msg.retain()).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
}