private void kickPresence(@Nonnull final Presence kickPresence, @Nullable final JID actorUserAddress, @Nullable String actorNickname, @Nullable final String reason)
    {
        // When no nickname is provided, try to look it up.
        final boolean hasActorJid = actorUserAddress != null;
        boolean hasActorNick = actorNickname != null && !actorNickname.isEmpty();
        if (!hasActorNick && hasActorJid) {
            actorNickname = findNickname(actorUserAddress);
        }
        hasActorNick = actorNickname != null && !actorNickname.isEmpty();

        final List<MUCOccupant> kickedOccupants;
        try {
            kickedOccupants = getOccupantsByNickname(kickPresence.getFrom().getResource());
            for (MUCOccupant kickedOccupant : kickedOccupants) {
                final Element item =  kickPresence.getChildElement("x", "http://jabber.org/protocol/muc#user").element("item");

                // Add the reason why the user was kicked
                if (reason != null && !reason.trim().isEmpty()) {
                    item.addElement("reason").setText(reason);
                }

                // Add the actor's JID that kicked this user from the room
                if (hasActorJid || hasActorNick) {
                    final Element actor = item.addElement("actor");
                    if (hasActorJid && canAnyoneDiscoverJID) {
                        actor.addAttribute("jid", actorUserAddress.toBareJID());
                    }
                    if (hasActorNick) {
                        actor.addAttribute("nick", actorNickname);
                    }
                }

                // Send a defensive copy (to not leak a change to the 'to' address - this is possibly overprotective here,
                // but we're erring on the side of caution) of the unavailable presence to the banned user.
                final Presence kickSelfPresence = kickPresence.createCopy();
                final Element fragKickSelfPresence = kickSelfPresence.getChildElement("x", "http://jabber.org/protocol/muc#user");
                fragKickSelfPresence.addElement("status").addAttribute("code", "110");
                kickedOccupant.send(kickSelfPresence);

                // Remove the occupant from the room's occupants lists
                removeOccupant(kickedOccupant);
            }
        } catch (UserNotFoundException e) {
            Log.debug("Unable to kick '{}' from room '{}' as there's no occupant with that nickname.", kickPresence.getFrom().getResource(), getJID(), e);
        }
    }
Kicks the occupant from the room. This means that the occupant will receive an unavailable
presence with the actor that initiated the kick (if any). The occupant will also be removed
from the occupants lists.

Note that the remaining occupants of the room are not informed by this implementation. It is the responsibility
of the caller to ensure that this occurs.

@param kickPresence     The presence of the occupant to kick from the room.
@param actorUserAddress The (real) JID of the actor that initiated the kick.
@param actorNickname    The nickname in the room of the actor that initiated the kick.
@param reason           An optional reason why the user was kicked (can be {@code null}).
xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java