diff --git a/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java index fbc8c7d3..5ca29c1d 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java @@ -7,6 +7,9 @@ import net.md_5.bungee.api.ServerPing; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.netty.ChannelWrapper; import net.md_5.bungee.netty.PacketHandler; +import net.md_5.bungee.netty.PipelineUtils; +import net.md_5.bungee.protocol.MinecraftDecoder; +import net.md_5.bungee.protocol.MinecraftEncoder; import net.md_5.bungee.protocol.Protocol; import net.md_5.bungee.protocol.packet.Handshake; import net.md_5.bungee.protocol.packet.StatusRequest; @@ -24,8 +27,14 @@ public class PingHandler extends PacketHandler public void connected(ChannelWrapper channel) throws Exception { this.channel = channel; + MinecraftEncoder encoder = new MinecraftEncoder( Protocol.HANDSHAKE, false ); + + channel.getHandle().pipeline().addAfter( PipelineUtils.FRAME_DECODER, PipelineUtils.PACKET_DECODER, new MinecraftDecoder( Protocol.STATUS, false ) ); + channel.getHandle().pipeline().addAfter( PipelineUtils.FRAME_PREPENDER, PipelineUtils.PACKET_ENCODER, encoder ); channel.write( new Handshake( Protocol.PROTOCOL_VERSION, target.getAddress().getHostString(), target.getAddress().getPort(), 1 ) ); + + encoder.setProtocol( Protocol.STATUS ); channel.write( new StatusRequest() ); }