Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void status(Session s, String HOST, int PORT) {
- MinecraftProtocol protocol = new MinecraftProtocol(SubProtocol.STATUS);
- Client client = new Client(HOST, PORT, protocol, new TcpSessionFactory(
- Proxy.NO_PROXY));
- client.getSession().setFlag(MinecraftConstants.AUTH_PROXY_KEY,
- Proxy.NO_PROXY);
- client.getSession().setFlag(MinecraftConstants.SERVER_INFO_HANDLER_KEY,
- new ServerInfoHandler() {
- @Override
- public void handle(Session session, ServerStatusInfo info) {
- Util.sendMsg(
- s,
- Config.PingYes
- + "&8[&a"
- + info.getDescription()
- + " &8| "
- + "&a"
- + info.getPlayerInfo()
- .getOnlinePlayers() + "&8/"
- + "&a"
- + info.getPlayerInfo().getMaxPlayers()
- + "&8]");
- }
- });
- client.getSession().setFlag(
- MinecraftConstants.SERVER_PING_TIME_HANDLER_KEY,
- new ServerPingTimeHandler() {
- @Override
- public void handle(Session session, long pingTime) {
- Util.sendMsg(s, Config.Ping + pingTime);
- }
- });
- client.getSession().connect();
- while (client.getSession().isConnected()) {
- try {
- Thread.sleep(5);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement