private void checkJoinRoomPreconditionMemberOnly(@Nonnull final JID realAddress, @Nonnull final Affiliation affiliation ) throws RegistrationRequiredException
    {
        boolean canJoin = !isMembersOnly() || Arrays.asList( Affiliation.admin, Affiliation.owner, Affiliation.member ).contains( affiliation );

        Log.trace( "{} Room join precondition 'member-only': User '{}' {} join room '{}'.", canJoin ? "PASS" : "FAIL", realAddress, canJoin ? "can" : "cannot", this.getJID() );
        if (!canJoin) {
            throw new RegistrationRequiredException( "This room is member-only, but you are not a member." );
        }
    }
Checks if the person that attempts to join is a member of a member-only room.

@param realAddress The address of the user that attempts to join.
@throws RegistrationRequiredException when joining is prevented by virtue of the user joining a member-only room without being a member.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java