Get source code here: https://drive.google.com/open?id=0B8QCGWUAvuUMTnZnTUlmY0VaZ0U
Get plugin here: https://drive.google.com/open?id=0B8QCGWUAvuUMaDBlME5wNVlaNjQ
This is a chat filter that I made for Bukkit 1.10.2 servers. This should be
compatible with Spigot, although I haven't tested it.
This plugin includes:
Special unicode character blocking!
Blocks over 200 words by default!
Automatically generated ban logs!
Filters the chat, books, signs, anvil items(renaming them), private messages, and even the player's username!
To use the plugin, unzip/place .jar in plugins folder. When you start the server, a
folder called "MinecraftChatFilter" will be created. Don't ever delete
this folder! It will contain some very important information, like ban
logs and statistics. The plugin comes with 200+ words in the filter by
default, although you can easily change this. You may need 7zip to open
the .jar file, though.
To edit the filter settings, open the plugin .jar file. You should see a text file containing all of the words
on the filter. All of the words have the following pattern: The word
itself(all uppercase), NOSPACES/SPACES, IGNORETRUE/IGNOREFALSE, and the
punishment level(kick, ban, and hide).
To add a word, type the word, but in uppercase(the filter automatically converts the messages
into uppercase before checking). There cannot be any spaces in the word,
or any characters that are ignored in the settings(I'll get on this in a
After the word, type in either "NOSPACES" or
"SPACES"(without the quotes). If you type in NOSPACES, that will tell
the filter to ignore spaces when checking for that specific word. So, if
my message is "W O R D", the filter will ignore the spaces, so the
message will be treated as "WORD" and the word will be successfully
caught. But, if you use SPACES instead, then the filter will take spaces
into consideration. "W O R D" will not catch "WORD". SPACES is useful
if you have a word that gets caught in other words a lot(grass, class,
Then, you will want to type in either "IGNORETRUE"
or "IGNOREFALSE". IGNORETRUE will ignore the characters you specify in
the ignore.txt file. IGNOREFALSE will not ignore any characters when
checking for that specific word. Usually you will want to put
IGNORETRUE, it makes it harder to dodge the filter. IGNOREFALSE is for
rare corner cases, such as the contraction "who're"
Finally, put the punishment level for the word, either "BAN", "KICK", or "HIDE". BAN
will ban anyone who says the word, KICK will kick them, and HIDE will
hide the message from everyone else(don't worry, the player will think
that the message was posted)
So, if I wanted to add "word123" in
the filter, ban anyone who uses it, and ignore spaces/ignorable
characters, I would do the following:
WORD123 NOSPACES IGNORETRUE BAN
But, if I wanted to not ignore spaces and ignorable characters and kick the player, this should be used:
WORD123 SPACES IGNOREFALSE KICK
Next, after almost every single word, you may notice lines that start with
"//" without the quotes. This is something I made up for ONLY the
chatfilter.txt file, it is a definition. When the plugin is enabled, the
words are loaded, but the definitions are ignored. Definitions
allow the admins/ops to learn what a word means, but not actually see it
for themselves. Since many of the words have disturbing, violent, or
perverted nature, looking them up on the internet can bring up horrible
images. This essentially allows them to not "learn it the hard way". To make a definition, just put // at the beginning of the line. The plugin will ignore it.
Moving on, the ignore.txt file contains every single character that will be
ignored(only when IGNORETRUE is being used, obviously)
You MUST put the characters on separate lines, though. This only ignores the
characters when checking, it won't block the characters though. NEVER
REPLACE NUMBERS WITH LETTERS! I know that people can talk like 7H15, but
replacing numbers will letters will definitely break the plugin.
The replace.txt file will contain the characters to replace, and to replace
with. This will only treat a certain character as another one, though.
You can still use the characters in your messages, and they will show
up, but $ECRET will be checked as SECRET, etc...
You have to put the
character you want to replace, then a space, then the character you want
to replace with. Always use capital letters when working with this
If you are an OP, you can use the /filterstats command. This will give you a quick breakdown of the filter's statistics.
The filter doesn't only block chat messages, but signs, anvil item renames,
books, and even the player's username when they join. By the way, if a
word has a HIDE level, and it is detected on something that is NOT a
chat message, then it will kick the player instead. I cannot block a
sign message to some players, but make it look like something else to
the player's POV. Also, the plugin blocks special unicode
characters(anything not basic latin). Do not use this plugin on
non-English servers, it will break the chat. If a ban log is generated
and unicode characters are in the message/whatever, the unicode parts
will be omitted from the ban log(because writing special unicode
characters to files isn't a good idea).
Moving on, if someone gets banned, a folder called "banlogs" will appear in the
MinecraftChatFilter folder. Inside this folder, you will see probably
lots of text files. Each players ban log is named after their IGN. If I
got banned by the plugin, my log would be named bindigo.txt, inside of
banlogs, inside of MinecraftChatFilter. There is tons of important
information in the ban logs, including ip address, time of message,
etc... Also if you delete the ban logs, it will not unban the player.
The player was banned by their uuid, so you have to /pardon them. The
ban logs are just for reference, in case someone sends the admins a ban
appeal. (The filter MAY make a mistake, false positives etc....)
If someone joins with an offensive username, they may or may not get
banned. If a ban-level threat is detected, their uuid will be banned, so
even if they change their name, they won't ever be able to join the
server. But, if a kick/hide level threat is detected, then it will kick
the player before they join. This is different than banning, though. If
they change their name after a kick/hide level threat, they will be
allowed to join.
The default chatfilter.txt list is not supposed
to be a list of recommended punishments for words. The list is supposed
to be the MINIMUM punishment you should ever give. I would personally
ban everything lol
Don't ever look anything up from the chatfilter.txt file, you'll definitely regret it.
To make the fake message for the HIDE punishment level, you may need to
download the source code, go to PlayerListener.java, and go to line 564.
This is where you should edit the code to make the fake message. By
default, the plugin will format the fake message, but the color is
white. The white color will be a huge problem if certain server ranks
have different chat colors(when they type the message in, it will hide
it, but the hidden text will have a different color to them than the
normal chat text). You'll have to recompile the plugin and use the new
though! Also, go to line 545, line 444, line 341, and line 261 in
MinecraftChatFilter.java to change the pseudo-messages for /msg, /tell,
/w, and /say.
If you have any questions, please leave them in the comments! Hope this helps!
I just added filtering for /msg, /tell, /w, and /say. This prevents
people from swearing in private messages. I blocked /tellraw completely
because I have no idea how to filter through JSON-formatted text, so no
players can use the command now.