public String findNickname(@Nullable final JID userAddress)
    {
        if (userAddress == null) {
            return null;
        }

        final MUCOccupant fullJidOccupant = occupants.stream().filter(occupant -> occupant.getUserAddress().equals(userAddress)).findAny().orElse(null);
        if (fullJidOccupant != null) {
            return fullJidOccupant.getNickname();
        }

        final MUCOccupant bareJidOccupant = occupants.stream().filter(occupant -> occupant.getUserAddress().asBareJID().equals(userAddress)).findAny().orElse(null);
        if (bareJidOccupant != null) {
            return bareJidOccupant.getNickname();
        }

        return getReservedNickname(userAddress);
    }
Attempts to find a nickname for a user.

This method will first check if there's an occupant that matches the provided user address. If none is found,
then any reserved nickname for the user address is returned.

When no nickname can be found, null is returned.

@param userAddress The (real) address for which to return a nickname
@return a nickname for the user, or null.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java