#vulnerable code 
                                public void sendMessage(CommandIssuer issuer, MessageType type, MessageKeyProvider key, String... replacements) {
        String message = getLocales().getMessage(issuer, key.getMessageKey());
        if (replacements.length > 0) {
            message = ACFUtil.replaceStrings(message, replacements);
        }

        message = getCommandReplacements().replace(message);

        MessageFormatter formatter = formatters.getOrDefault(type, defaultFormatter);
        if (formatter != null) {
            message = formatter.format(message);
        }

        for (String msg : ACFPatterns.NEWLINE.split(message)) {
            issuer.sendMessageInternal(msg);
        }
    } 
                            #location 11 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                public void sendMessage(CommandIssuer issuer, MessageType type, MessageKeyProvider key, String... replacements) {
        String message = formatMessage(issuer, type, key, replacements);

        for (String msg : ACFPatterns.NEWLINE.split(message)) {
            issuer.sendMessageInternal(ACFUtil.rtrim(msg));
        }
    }