public static void disconnect(Player p) throws IOException { Socket s = p.getPlayerSocket(); if (!onlinePlayers.contains(p.getPlayerName()) && Player.getPlayerName() == null) { s.close(); p = null; System.gc(); } else { s.close(); onlinePlayers.remove(p.getPlayerName()); p = null; System.gc(); } }