private void kickOccupantBecauseOfNicknameCollision(MUCRoom room, String nickBeingAddedToRoom, JID userToBeKicked, @Nonnull OccupantManager occupantManager) {
        Log.info(
            "Occupant {} of room {} with nickname {} has to be kicked out because the nickname clashes with another user in the same room.",
            userToBeKicked,
            room.getName(),
            nickBeingAddedToRoom
        );

        // Kick the user from all the rooms that he/she had previously joined.
        try {
            final List<Presence> kickedPresences = room.kickOccupant(userToBeKicked, room.getSelfRepresentation().getAffiliation(), room.getSelfRepresentation().getRole(), null, null,"Nickname clash with other user in the same room.");

            for(final Presence kickedPresence : kickedPresences) {
                Log.trace("Kick presence to be sent to room: {}", kickedPresence);

                // Send the updated presence to the room occupants, but only those on this local node.
                room.send(kickedPresence, room.getSelfRepresentation());
            }

            Log.debug("Kicked occupant '{}' out of room '{}'.", userToBeKicked, room.getName());
        } catch (final ForbiddenException | NotAllowedException e) {
            // Do nothing since we cannot kick owners or admins
            Log.debug("Occupant '{}' not kicked out of room '{}' because of '{}'.", userToBeKicked, room.getName(), e.getMessage());
        }
    }
Kick a user out of a room for reason of nickname collision.
@param room The room to kick the user out of.
@param nickBeingAddedToRoom The nickname that is the cause of the problem.
@param userToBeKicked The full jid of the user to be kicked.
@param occupantManager The occupant manager that contains local occupant registration.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/LocalMUCRoomManager.java