public void disconnect(String message){ //called when disconnecting from server
        if (message == null) message = "No message given.";
        System.out.println("Client "+user.getName()+ " disconnected");
        if (message!=null && chatRoom!=null) chatRoom.tellEveryone(user.getName()+" (disconnecting)", message);
        if (chatRoom!=null) chatRoom.tellEveryone("Server Message", ""+user.getName()+" disconnected"); //server message
        tell("Server Message", "You have been disconnected: "+message);
        this.user = null; //causes the thread to stop
        try{
            this.socket.close();
            this.in.close();
            this.out.close();
        } catch (Exception e) { System.out.println("Caught non-problematic exception: "+e); }
    }