public void addThread(ChatServerThread thread){ //replaces the first dead thread with this one, taking its id
        int count = threads.size(); boolean found = false;
        for (int i = 0; i<count; i++){
            ChatServerThread thread2 = threads.get(i);
            if (thread2==null || !thread2.isAlive()){
                thread.setID(i);
            //    thread.setUserName(""+i);
                threads.remove(i);
                threads.add(i, thread);
                System.out.println("New thread added and ID set to "+i+".");
                found = true;
                break;
            }
        }
        if (!found){
            threads.add(thread);
            thread.setID(count);
            //thread.setUserName(""+count);
            System.out.println("New thread added and ID set to "+count+".");
        }
        //thread.tell("Server Message", "You've joined the chat room "+name+".");
        //tellEveryone( "Server Message", ""+thread.getUserName()+" joined the room."); //id -1 reserved for server messages
    }