#My brain hurts sooo bad for this. (JAVA/SPIGOT ISSUE)

1 messages · Page 1 of 1 (latest)

real spruce
#

I am creating a profanity filter, and I have now created a more efficent way of reading words.

This is the Word model.

package me.xemu.xemchatprotection.word;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@AllArgsConstructor
@Getter
@Setter
public class Word {
    private String word;
    private List<String> aliases;
    private List<String> ignoreWith;
}

This is how I read the list over Words:

    public static List<Word> getWords() {
        List<Word> words = new ArrayList<>();
        for (String w : XemChatProtection.INSTANCE.getWords().getSection("Profanity").keySet()) {
            words.add(
                    new Word(w,
                            XemChatProtection.INSTANCE.getWords().getStringList("Profanity." + w + ".aliases"),
                            XemChatProtection.INSTANCE.getWords().getStringList("Profanity." + w + ".ignoreWith")));
        }
        return words;
    }

But I want a way to read a string in this way:

  • Check if string contains the main word
  • Check if string contains a alias of the word, if it doesnt contain the main word
  • Don't cancel the message (ignore the profanity) if the string contains a ignoreWith string.
honest boughBOT
#

<@&987246652869971988> please have a look, thanks.

honest boughBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

real spruce
honest boughBOT
#

Closed the thread due to inactivity.

If your question was not resolved yet, feel free to just post a message to reopen it, or create a new thread. But try to improve the quality of your question to make it easier to help you 👍

real spruce
#

.