public boolean setUsername(String name, boolean weak) {
        if (name != null && name.length() > 16) {
            return false; // nope
        }

        // if weak is true, only update the value in the User if it's null
        if (weak && this.username != null) {

            // try to update casing if they're equalIgnoreCase
            if (this.username.equalsIgnoreCase(name)) {
                this.username = name;
            }

            return false;
        }

        // consistency. if the name being set is equivalent to null, just make it null.
        if (name != null && (name.isEmpty() || name.equalsIgnoreCase("null"))) {
            name = null;
        }

        // if one or the other is null, just update and return true
        if ((this.username == null) != (name == null)) {
            this.username = name;
            return true;
        }

        if (this.username == null) {
            // they're both null
            return false;
        } else {
            // both non-null
            if (this.username.equalsIgnoreCase(name)) {
                this.username = name; // update case anyway, but return false
                return false;
            } else {
                this.username = name;
                return true;
            }
        }
    }
Sets the users name

@param name the name to set
@param weak if true, the value will only be updated if a value hasn't been set previously.
@return true if a change was made
common/src/main/java/me/lucko/luckperms/common/model/User.java