Fixed Legacy Ping handling (#1180)

This commit is contained in:
Adrian
2024-01-11 01:57:03 -05:00
committed by GitHub
parent 408b420af7
commit cc906000bc

View File

@@ -362,8 +362,17 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
ensureInEventLoop(); ensureInEventLoop();
this.state = state; this.state = state;
this.channel.pipeline().get(MinecraftEncoder.class).setState(state); // If the connection is LEGACY (<1.6), the decoder and encoder are not set.
this.channel.pipeline().get(MinecraftDecoder.class).setState(state); final MinecraftEncoder minecraftEncoder = this.channel.pipeline()
.get(MinecraftEncoder.class);
if (minecraftEncoder != null) {
minecraftEncoder.setState(state);
}
final MinecraftDecoder minecraftDecoder = this.channel.pipeline()
.get(MinecraftDecoder.class);
if (minecraftDecoder != null) {
minecraftDecoder.setState(state);
}
if (state == StateRegistry.CONFIG) { if (state == StateRegistry.CONFIG) {
// Activate the play packet queue // Activate the play packet queue