public synchronized static int getStatus() {
        if (serverMainThread == null) {
            return DEAD;
        } else if (serverMainThread.isAlive()
                && !serverMainThread.isInterrupted()) {
            return RUNNING;
        } else if (serverListeningThreads == null) {
            return DEAD; //when server has been closed
        } else {
            for (ServerListeningThread slt : serverListeningThreads) {
                if (slt != null && slt.isAlive() && !slt.isInterrupted()) {
                    return PLAYERS_CONNECTED;
                }
            }
            return DEAD;
        }
    }