private List<Presence> applyRoleChange(@Nonnull final JID userAddress, @Nonnull final Role newRole)
    {
        final List<Presence> presences = new ArrayList<>();
        // Get all the roles (i.e. occupants) of this user based on his/her bare JID
        final List<MUCOccupant> occupants;
        try {
            occupants = getOccupantsByBareJID(userAddress);
        } catch (UserNotFoundException e) {
            return presences;
        }

        // Collect all the updated presences of these roles
        for (final MUCOccupant occupant : occupants)
        {
            // Update the presence with the new role
            occupant.setRole(newRole);

            // Prepare a new presence to be sent to all the room occupants
            presences.add(occupant.getPresence());
        }
        // Answer all the updated presences
        return presences;
    }
Updates the internal state of a given occupant after a role change has been applied.

Do nothing if the given jid is not present in the room.

If the user has joined the room from several client resources, all his/her occupants' presences will be updated.

@param userAddress the (real) JID of the occupant that is affected.
@param newRole the new role for the occupant.
@return the list of updated presences of all the client resources that the occupant has used to join the room.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java