#Creating a chat Filter
1 messages · Page 1 of 1 (latest)
I did I type different swears and it sends the message as normal
Let me try putting message.contains instead of equals ignore case
To lower case the message before contains chekc
@restive geode updated code
you havent registered the actual listener
yes they did, or it would not be trying to pass the event.
the issue appears to be that you are indexing your array from 1
its trying to get array pos 0
that is null
cannot compare null
aahh I always forget about arrays starting at 0
you indexed your array from 1 but looped from 0
so, yeah
also this appears to only filter chat if their message is only exactly one of the swear words?
no it works if the message contains other strings + swears
Also it works now
thanks for your help
oh, the contains
however, this filter is susceptible to the clbuttic mistake
type the word classic, which is a valid non-swear word but it contains the substring ass
your filter will say "bad word"
yeah It's very arachic. I don't even have it setup so that ops can add filters without re-compiling
I just wanted to get it setup first
alrighty
filters are not easy to make, which you'll probably soon come to realize. but good luck!
Thanks for your help, I'm actually a freshman in college right now so I'm making this to learn Java
Adding config variables isnt hard
yep it is good practice. but the problem itself is difficult, specially in figuring out how to fix the clbuttic mistake. it's actually a notorious problem in computer science
but, have fun
https://en.wikipedia.org/wiki/Scunthorpe_problem
if interested. will take my leave now
The Scunthorpe problem is the unintentional blocking of websites, e-mails, forum posts or search results by a spam filter or search engine because their text contains a string (or substring) of letters that appear to have an obscene or otherwise unacceptable meaning. Names, abbreviations, and technical terms are most often cited as being affecte...
this is more of a LearningJava instead of LearningSpigot type of case 💀
or actually, learning basic logic
first things first you would want to retrieve an actual list of swear words, so I would recommend https://github.com/coffee-and-fun/google-profanity-words/blob/main/data/list.txt
then, you would get the message to lowercase
split the message into words
check if array of bad words contains any word from the message
if it does, do what you want it to do