Fixed bedrock pinging not working

This commit is contained in:
RaphiMC 2023-10-04 18:20:56 +02:00
parent b33f2ac5fa
commit 8a51d507bb
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94

View File

@ -86,9 +86,11 @@ public class BedrockProxyConnection extends ProxyConnection {
private ChannelFuture ping(final ServerAddress serverAddress) {
if (this.channelFuture == null) this.initialize(new Bootstrap());
this.getChannel().pipeline().replace(VLPipeline.VIABEDROCK_FRAME_ENCAPSULATION_HANDLER_NAME, "ping_encapsulation", new PingEncapsulationCodec(serverAddress.toSocketAddress()));
this.getChannel().pipeline().remove(VLPipeline.VIABEDROCK_PACKET_ENCAPSULATION_HANDLER_NAME);
this.getChannel().pipeline().remove(MCPipeline.SIZER_HANDLER_NAME);
this.channelFuture.channel().eventLoop().submit(() -> {
this.getChannel().pipeline().replace(VLPipeline.VIABEDROCK_FRAME_ENCAPSULATION_HANDLER_NAME, "ping_encapsulation", new PingEncapsulationCodec(serverAddress.toSocketAddress()));
this.getChannel().pipeline().remove(VLPipeline.VIABEDROCK_PACKET_ENCAPSULATION_HANDLER_NAME);
this.getChannel().pipeline().remove(MCPipeline.SIZER_HANDLER_NAME);
});
return this.getChannel().bind(new InetSocketAddress(0));
}