boolean nickConflict = room.isInRoom(nick);
boolean nickRewritten = false;
int counter = 1; // max conflicts, to avoid DoS attacks
String rewrittenNick = null;
while (nickConflict && counter < 100 && room.rewritesDuplicateNick()) {
rewrittenNick = nick + "_" + counter;
nickConflict = room.isInRoom(rewrittenNick);
if (nickConflict) {
counter++;
} else {