public void disconnect() { if (bot != null) { System.out.println("Disconnected"); bot.getConnectionHandler().disconnect(""); bot.getEventManager().unregisterListener(this); bot = null; loadingState = 0; status("Waiting."); progress(0, false); } }
@EventHandler public void onHealthUpdate(HealthUpdateEvent event) { ui.updateStatus(); if (loadingState == 3) { loadingState = 4; status("Connected."); progress(100); } if (event.getHealth() <= 0) bot.getEventManager().sendEvent(new RequestRespawnEvent()); }