Search in sources :

Example 1 with ServerInfoHandler

use of com.github.steveice10.mc.protocol.data.status.handler.ServerInfoHandler in project DragonProxy by DragonetMC.

the class PingThread method setClient.

private void setClient() {
    this.client = new Client(DragonProxy.getInstance().getConfig().remote_server_addr, DragonProxy.getInstance().getConfig().remote_server_port, new MinecraftProtocol(SubProtocol.STATUS), new TcpSessionFactory());
    this.client.getSession().setFlag(MinecraftConstants.SERVER_INFO_HANDLER_KEY, (ServerInfoHandler) (session, info) -> {
        this.info = info;
        this.client.getSession().disconnect(null);
    });
}
Also used : Client(com.github.steveice10.packetlib.Client) Session(com.github.steveice10.packetlib.Session) TcpSessionFactory(com.github.steveice10.packetlib.tcp.TcpSessionFactory) SubProtocol(com.github.steveice10.mc.protocol.data.SubProtocol) DragonProxy(org.dragonet.proxy.DragonProxy) MinecraftProtocol(com.github.steveice10.mc.protocol.MinecraftProtocol) ServerInfoHandler(com.github.steveice10.mc.protocol.data.status.handler.ServerInfoHandler) ServerStatusInfo(com.github.steveice10.mc.protocol.data.status.ServerStatusInfo) Executors(java.util.concurrent.Executors) MinecraftConstants(com.github.steveice10.mc.protocol.MinecraftConstants) MinecraftProtocol(com.github.steveice10.mc.protocol.MinecraftProtocol) Client(com.github.steveice10.packetlib.Client) TcpSessionFactory(com.github.steveice10.packetlib.tcp.TcpSessionFactory)

Aggregations

MinecraftConstants (com.github.steveice10.mc.protocol.MinecraftConstants)1 MinecraftProtocol (com.github.steveice10.mc.protocol.MinecraftProtocol)1 SubProtocol (com.github.steveice10.mc.protocol.data.SubProtocol)1 ServerStatusInfo (com.github.steveice10.mc.protocol.data.status.ServerStatusInfo)1 ServerInfoHandler (com.github.steveice10.mc.protocol.data.status.handler.ServerInfoHandler)1 Client (com.github.steveice10.packetlib.Client)1 Session (com.github.steveice10.packetlib.Session)1 TcpSessionFactory (com.github.steveice10.packetlib.tcp.TcpSessionFactory)1 Executors (java.util.concurrent.Executors)1 DragonProxy (org.dragonet.proxy.DragonProxy)1