YetAnotherSwearingFilter
YASF: Yet Another Swearing Filter
YASF is yet another swearing filter, which has advanced, built-in "Smart Filters" along with the ability to create your own custom Filters. YASF also allows you to choose which Actions to take when a violation is detected (kick, kill, burn, ban, deop, send a message to the player, and/or any number of custom server actions).
Features
- Advanced "Smart Filters" (see below), along with user-defined RegEx (regular expression) Filters;
- Blocks commands that contain swear words (via a server customizable list);
- Applies various actions when a violation occurs (kick, kill, burn, ban, deop, send message, and/or run custom server commands);
- Optionally bans players that receive too many swearing violations (configurable), or applies a set of custom actions and commands;
- Optionally bans players from joining the server if their name contains one of the defined swear words (configurable; you can also provide a list of players that are excluded from this check if this is enabled);
- Ability to add your own custom words (rules) to the list (using regular expressions).
Currently there are eleven built-in Smart Filters to choose from (you may define your own custom filters as well; a dozen custom filtered words are included in the default "filters.yml" file, both as examples and as additional words to filter on), which filter not only on the word itself but also on many variations of that word. All filters (custom and built-in) are case-insensitive and automatically take into account accented characters. For example:
- the word "Duck" might filter on: duck, duk, dvck, d*u*c*k, d uck, dűćķ, d\_/ck, ddddddduuuuuucccckkkkk, etc.
- the word "Shot" might filter on: shot, sh0t, $hot, s*h*o*t, s h o t; BUT NOT phrases like: it's hot.
- the word "All": might filter on: all, allhole ;-) BUT NOT words like: call, or ball, or alloy.
- similarly, for a word that could be both a person's name and also an offensive word depending on its usage (i.e., Dick), the built-in Smart Filter makes an attempt to determine the usage/intent and filter accordingly. Note: because some sentences with this name/word could be interpreted either way, there are situations where this filter won't correctly identify the negative usage (you can define your own custom filter if you prefer a more strict filter for this case).
You can also choose how many swearing de-merits should be given for any set of words (e.g., more severe words can receive more de-merits than less derogatory words).
Commands
- /yasf - prints out the user's current number of violation demerits.
- /yasf test <phrase> - [admin console only] allows you to test words/phrases against the currently running swear filters.
- /yasf player <playerName> - [admin console only] queries how many de-merits the given player currently has.
- /yasf setplayer <playerName> <demeritCount> - [admin console only] sets the number of de-merits for the given player.
- /yasf reload - [admin console only] reloads the plugin and all configuration and rule changes.
Configuration
See (edit) the filters.yml file for instructions on configuring your own Rules and Filters (the defaults may be fine for many people).
Warning: The "filters.yml" file contains offensive language, as all of the swear words to filter on are configured there.
How to Install
- Drag and drop the .jar file into your plugins folder.
- Stop and restart your server, or "/reload" the plugins while your server is running. The initial filter defaults are now active.
- Set up the "filters.yml" file however you want (define your own filters and/or use the built-in ones), and type "yasf reload" from the server console (or use "/reload" to reload all of the plugins) for the new settings to take effect.
Note: to unban someone that has been automatically banned from the server for too much swearing, you'll need to manually edit the "warnings.yml" file. Beside the players' names are the number of violations they currently have. Reset or lower that number to below the ban-threshold.
Examples
The default "filters.yml" file contains documentation and examples on how to create Rules, how to use the built-in smart filters, how to create your own custom filters (which utilize powerful "regular expressions"), and how to define what Actions to take (including defining your own custom actions).
See also this page for more information: Usage-Examples
Please report any inaccuracies in the filters so that they can be corrected as quickly as possible. Thanks.
Note: this plugin sends usage data to MCStats (see: http://mcstats.org/plugin/YetAnotherSwearingFilter).
@OmniscientHF
Some of the initial requests were for kid-friendly servers, which is why players with offensive names were also banned. Commands were also included as there are a number of ways you could otherwise still have swearing on the site (mail, and any command that lets you enter a message after it).
I'll add a way to exempt certain players and/or operators.
Also even commands are censored. So let's say I want to unjail a member with an offensive name or unban him the admin/op gets banned too. This has to get fixed otherwise this plugin is practically unusable.
How about adding players to be exempt? Your default actually deops. Not cool I tested it and was deoped. And I should be able to allow exempt to my staff or admins.
when I add word it just keep say 'UNKNOWN STANDARD FILTER: xxxx'
what is the problem.
@Squawkers13
I have a new update that allows you to customize the max-warnings actions (instead of just the default "ban"). It also has some other features that have been asked for (the ability to reload the plugin, etc.). I'm just letting it run on our server for a few days to make sure it works ok, and then I'll upload it.
Could you add a function to customize the max-warnings ban command? (i.e, instead of /ban, /jail?)
@Garrash
Yes. The user defined "regexFilter" allows you to enter any regular expression in your filters.yml file, which includes strings, words, and/or sentences. Google "regex" or "regular expressions" for more info.
Is there any kind of string/sentence support? I'm using this on my server and it's working great but there are a few sentences I'd like to block as well.
@TheLecturer
I had initially thought about putting the default regex into a config file, but my initial thought was that any updates (fixes/enhancements) to those filters would be more difficult to update (e.g., while people might update the plugin .jar file, they may have made customizations to their config.yaml file and wouldn't integrate the new regex filters).
Also, if there is some variant of a word that _isn't_ caught, you can always add your own custom regex filters to add additional checks and/or filter on other words (so, there's currently two ways of filtering: via the built-in filters, and via custom user-defined filters). You can also disable the built-in filters by not including them in the config.yaml file if you don't like what they filter on.
@TheLecturer
Yeah! That's a great idea! Using /reload for plugins is a very bad idea.
@dexserver
Thanks dexserver, look forward to it.
Another request. Could you put the regex for the "built-in" filters in the default config.yml rather than embedded in the plugin, that way if there is some variant that isn't caught, we have the opportunity to update it?
Thanks.
@TheLecturer
Sure, I'll be updating the plugin for the 1.6 bukkit release (I've been travelling a fair bit lately and haven't been able to work on this plugin much in the past couple of months, but should have some time in the next couple of weeks).
In the meantime, I've just been using bukkit's "reload" command (which reloads all of the installed plugins) if I've wanted to reload a particular plugin.
Any chance of getting a 'yasf reload' command so the filter file can be reloaded without having to take the server down?
(don't want to do a generic Bukkit 'reload' as it always breaks something).
Thanks.
@TheLecturer
I tested "massive" on my server and I don't get a false positive from that myself.
The current regEx for that filter, btw, is:
"([a@4][s$][s$]?h[o0]l[ez])|((
b)(a[^a-z]*[s$][^a-z]*[s$]+)(
b))|((
b)([a@4][^a-z]*[s$][^a-z]*[s$][^a-z]*e[^a-z]*[s$]+)(
b))|(jack[a@4][s$][s$])|(dum[bß][a@4][s$][s$])|(smart[a@4][s$][s$])|(tight[a@4][s$][s$])|([@4][s$][s$]+)"
Note that the above is escaped for use within a java string.
@TheLecturer
The open bracket "(" is a potential substitute for a "C", so it's filtering on COK == (OK
I can look at changing that to a less aggressive filter, or specifically try to exclude emoticons.
Another false positive from the built-in set:
"ass" filter triggers on massive
Thanks.
One more from me....
A player triggered YASF with the text :
:( ok
If that got turned into a symbol, then it is a colon, an open curved bracket, a space then ok
I tried the same text on the console with yasf test and it is picking it up as a swear word. This is with the default generated filters.yml
Any ideas why?
I am so glad I discover this plugin, and so glad you wrote it. I run a server for kids, and perversely that seems to attract the foulest members of the minecraft community who seem to find it a challenge to try to beat whatever anti-swear systems are in place. So I've tried quite a few - some are too basic, and others are so harsh it was banning my regular players for innocent chat. I've put some effort into learning regex and have compiled a fairly comprehensive list for this plugin to use. Each of the words is checked for letter variants e.g.
...and each word configured to check for s p a c e s or c/h/a.r*a-cter-s.
It's taken a fair bit of work so I thought I'd share it for any other server admins who are trying to clean up their server. To avoid adding more filth to this page :-) I've put my entire "filters.yml" up here : http://pastebin.com/yDfXvYQx The file includes comments listing all the words covered as the regex code is practically unreadable.
If you have any improvements or additions, please post them. Also, there are a couple of false positives I am aware of that I haven't had a chance to try to get rid of, these being "banal" and "analyze" - I can't seem to get the \b boundary marker to work with the [\W] non-character marker. Not too bothered as I can't see either of these being regularly used by 12 year old minecrafters.... But if you know better....feel free.
I am hoping very very much that this plugin is maintained. Thank you dexserver.
Is there a command to reload the filter.yml file, other than reloading ALL plugins (which tends to kill bukkit)? If not, could we have one please?
Thanks.
I do love this plugin, but I have some minor nit-picks about it.
Adding on to BrotheBear's suggestion, it would be neat to have the ability to have permissions to determine if a user/group can bypass the filters instead of just a simple is-server-op check. (Using Vault or similar to make life easy for everyone)
The ability to reload the config via an in-game command would be helpful as well, and possibly the option to make a way to disable blocking of a word that matches a filter.
Meaning if the filter "asdf" is triggered, it will still allow the message to get through to the chat, but will still do the configured actions. This would make it so you could have words that, for example, could run the server command to remove a certain amount of money from the offending player if they said a word, but the word itself wasn't something that is actually a swear. Could be useful for annoying words to discourage their use by sending a message to the player, or for all-caps messages, it would still allow it but could be set to send a message saying not to do that, subtract some of their money, etc.
But other than those minor things above, the plugin works great, and it's detection accuracy is very good! Thank you! As far as the command goes to add a new filter in-game, it could be just basic patterns. It could escape all the non-regex-friendly characters and make it a case-insensitive match, and use the default configured actions. That would let people temporarily do something like "/yasf add budder" and have it just block anything containing "budder". The complex regexing could be left to config editing, but having a command to do quick on-the-fly blocking could be helpful.