Close #689 - fix serverinfo.ping
This commit is contained in:
parent
26863032a1
commit
02619c6132
@ -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() );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user