The filter
Block insults, ads, spam and caps in chat, allow the words you want, and turn repeat offences into warnings, mutes and bans.
The filter reads every message before it reaches chat. It blocks or masks insults, IPs, links, phone numbers, repeated messages, floods and shouting in capitals, and it adds up points that turn into warnings, mutes or bans. It works in English and Spanish out of the box.
Before you start#
The built-in chat must be on, see The chat module. Staff and anyone with a bypass permission skip the check named by it, for example exyliachatcosmetics.chat.bypass.filter, see Permissions.
Block a word#
Open the rules
Edit plugins/ExyliaChatCosmetics/chat/filter/rules.yml, or run /cca menu, click Filter, then Word rules.
Add the word
Add it to a group under rules:, or write a new group:
rules:
my-words:
points: 2
words:
- badwordReload
Run /cca chat reload.
points is what each hit costs the player. The shipped file has everyday swearing at 2 points, insults at 4, slurs at 12 and hate symbols at 15, in English and Spanish.
A word is a whole word by default, with common endings allowed: puta catches puta, putas and putita, but not disputa. Add a star to widen it: puta* anything after, *puta anything before, *puta* anywhere. Leet spelling (f4ck), spaced letters (f.u.c.k) and repeated letters (fuuuck) are caught for you, and accents are ignored.
Check that it works#
Write the word in chat. By default the message is blocked. Run /cca chat history <player> to see what the filter caught, and /cca chat regex <word> to see what a word compiles to. Staff with exyliachatcosmetics.chat.staff.alerts get an alert for every trip.
Allow a word the filter blocks#
Add it to chat/filter/whitelist.yml under words:. A whitelisted word is hidden from the rules before they read the line, so cocktail never trips cock. The same file takes domains (your own sites), urls, ips, and unicodes (symbols allowed when the odd-characters check is on).
No list suits every server. Words that only sound like insults in some regions are left out on purpose. Put a word your players use innocently in whitelist.yml, and a word your region treats as an insult in rules.yml.
Block or mask: spam, links and IPs#
Open chat/filter/config.yml (or /cca menu, Filter). Each check can be switched off, and the pattern checks (ip, url, domain, phone, unicode) can mask the match instead of blocking: set cancel: false and the match is replaced by replace-with (*). Defaults:
| Check | Default |
|---|---|
cooldown | 1.5 seconds between messages |
similarity | Blocks a message 90% like the last one, remembered for 8 seconds |
flood | Blocks messages over 120 characters or with 5 repeated characters |
caps | More than 8 capitals: lowercased, not blocked |
ip, url, domain, phone | Blocked, 5 points each |
unicode | Off. Turning it on blocks accents and symbols unless you list them in whitelist.yml |
The cooldown only starts when a message goes out, so a blocked message does not cost the next second and a half. To tune similarity, run /cca chat similar <first> <second> to see the score of two lines.
Punish repeat offenders#
Every hit adds points to the player, even when the message was blocked. In lang/<language>/chat/filter/punishments.yml each punishment starts at a total of points:
| Name | At points | What it does |
|---|---|---|
warn | 6 | Tells the player to mind the rules |
mute | 15 | Runs console: mute %player_name% 1h Chat rules |
ban | 40 | Runs console: tempban %player_name% 1d Chat rules |
The mute and tempban commands are examples: change them to what your punishment plugin uses. A player who crosses several lines in one message gets only the highest. Points fade: a player quiet for 60 minutes starts from zero (punishments.reset-after-minutes). Run /cca chat points <player> to read a total, and /cca chat points <player> <number> to set it, which is how you forgive somebody.
config.yml keys and defaults
| Section | Keys and defaults |
|---|---|
similarity | enabled true, threshold 0.9, cache-seconds 8.0 |
flood | enabled true, max-length 120, max-repeated 5, alert-staff true |
caps | enabled true, max-caps 8, lowercase true (rewrites the message instead of blocking it) |
cooldown | enabled true, seconds 1.5 |
ip, url, domain, phone | enabled true, replace-with *, cancel true, alert-staff true, points 5 |
unicode | the same, but enabled false |
rules | enabled true, replace-with *, cancel true, alert-staff true |
punishments | enabled true, reset true, reset-after-minutes 60 |
history | enabled true, keep 50: how many caught messages per player /cca chat history can show |
The pattern checks run in the order ip, url, domain, phone, unicode. The cooldown message is filter.cooldown in lang/<language>/chat/messages.yml (%time_left%, %time%). The staff alert is staff.alert there, with %player%, %points%, %rules%, %message%.
rules.yml also has advanced: for regexes written by hand, with their own points. A group that lists nothing, or a regex that does not compile, is reported by name and skipped. leet.yml maps each letter to what may stand in for it (a: '@4^'). ñ is not folded to n, but is a leet stand-in for n.
Staff nodes: exyliachatcosmetics.chat.staff.alerts reads every trip; exyliachatcosmetics.chat.staff.filtered also sees the blocked messages, marked with filtered-marker. Plugins can cancel a punishment with ChatInfractionEvent, see API.
Something missing on this page? Tell us on Discord