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).
-
View User Profile
-
Send Message
Posted Apr 25, 2013@chilgames
You can always: 1) dynamically change the number of warnings a player has through the bukkit console via "yasf setplayer <playerName> <newDemeritCount> (to an amount less than the ban amount); 2) manually change the numer of warnings a player has by editing the warnings.yml file (to an amount less than the ban amount); 3) change the settings in the config file (e.g. "maxwarnings") to increase the maxwarnings before getting banned.
I will be making other changes (as per some of the previous comments), but the existing functionality should enable you to get back on your own server.
-
View User Profile
-
Send Message
Posted Apr 19, 2013I typed /sh as an op (I was trying to type /shift) and I got banned now I can't get back on my server ever. Please fix this.
-
View User Profile
-
Send Message
Posted Apr 3, 2013@BrotheBear
Hm. Editing the standard filter in-game might be awkward, considering that the filters are regular expressions (which can be tricky to write/edit and get right), and the filters are associated with custom actions (it might be a bit of work to make an interface that would be easy/simple to use to select which filter you're interested in, etc.). I'll need to think on that one.
As for allowing OPs to be immune to the filter, I'll look into what it would take to implement permissions (which might be a better overall solution?), but I could probably add a quick boolean flag to indicate whether or not OPs would be checked against the filters). That option should be fairly quick to implement
I'll put that in one of the next builds.-
View User Profile
-
Send Message
Posted Mar 28, 2013Would it be possible to allow OP's to edit the standard filter ingame, and be immune to the filter please?
-
View User Profile
-
Send Message
Posted Mar 12, 2013@ravenx99
Thanks for the bug report. This is fixed in version 1.2.0.
I've also added the string "group, huh" to my unit tests to ensure that one doesn't happen again. And I will try to upload the source code soon (so that people have access to the latest regexes being used).
As for this bug, someone had asked for a phonetic variations of a certain word, specifically phuc, phuck, phuk. Unfortunately in my haste I wrote the regex with "c*" and "k*", making them both optional; hence "phu" would also trigger the filter, as in "grouP, HUh?" (I also add "[^a-z]*" between most letters - with some exceptions to account for real uses of them - to catch cases where people put spaces and/or non-numeric characters between letters to try to fool the filter, such as "D, , , U , , , C , , , K").
BTW, you can use YASF to write your own regex expressions (and you don't have to use the pre-defined filters if they're not filtering how you'd like them to). So you could just use it as a custom regex filter.
-
View User Profile
-
Send Message
Posted Mar 12, 2013YASF v1.1.6 just kicked someone for saying "group, huh" (the exact phrase recorded in the log), with a bump-count of 1, so it must have been an internal word match. (It'd be nice to see those patterns for reference, evil as regexes are to read.)
Haven't tried it with 1.2.0, as the owner decided to uninstall the mod. We might move back to it... if we need a swear filter, I like having access to write regexes.
-
View User Profile
-
Send Message
Posted Feb 9, 2013@AKMiner98
At some point I'll look at uploading the source somewhere. For now, the quickest thing might be just to open up the jar file through a java decompiler.
-
View User Profile
-
Send Message
Posted Feb 5, 2013@FurmigaHumana
the words i'm adding now aren't in english
For now, make sure the words you add to your filter do not have accents in them (sorry for being a bit short-sighted: I assumed English words, so the code to remove accents assumes the original word filters didn't have any accents to begin with). There might also be a greater potential for "false positives" on some of the filters (depending on whether a variant of the English swear word is a valid word or word-fragment in the other language). In that case, though, you could always disable the built-in filter and add your own.
I'll correct the accent issue in a future version (basically, with a few exceptions, the new code that I'll write for this will automatically remove any accents from the filters, as the current current code tries to strip accents from the text being checked.)
I am looking into adding additional built-in filters for some other languages, btw, although without having a good understanding of the language in question I may not be able to create the most accurate filters (I may not know what the variations of that word might be, or what acceptable exceptions might be).
-
View User Profile
-
Send Message
Posted Feb 5, 2013@dexserver
thanks for your time! And don't worry about adding some words as default, the words i'm adding now aren't in english.. so.... :D
thanks :)
-
View User Profile
-
Send Message
Posted Feb 4, 2013Can I see the source files and resources?
-
View User Profile
-
Send Message
Posted Feb 4, 2013@FurmigaHumana
The "filter:" keyword is used to enable the standard, built-in "smart" filters. These are pre-built filters that have been tested against a number of variations of the given word: e.g., duck, d*u*c*k, duuuuuck, D\_/CK, etc.
To define your own list of words, use the "regexFilter:" keyword (a non-trivial example is given in the default filters.yml file). The filter needs to be formatted as a "regular expression" (RegEx). It's more complicated than a basic string / word, but much more powerful.
In your example, you'd configure it like:
regexFilter: myCuteWord|myCuteWord2
The pipe ("|") symbol is like an "OR" in regEx, so you can add your words together that way (or create multiple Rules, with each word in its own Rule).
As another example, let's say you wanted to search on "Sock" as well as "$ock" or "Sok" or repeated letters like "$sssoooocck" (or any combination or variation of those options). The following regexFilter would do that:
regexFilter: [s$]+o+c*k+
As a final example, what if you wanted to filter on the word "all", but not words like "ball" or "alloy" or "balloon"? Some of the other swearing filters require you to define lists of excluded words (and hopefully you catch all of them). With RegEx, you can instead use the following rule:
regexFilter: (\b)all(\b)
The "\b" in regex denotes a word Boundary (beginning or end of a word). [The brackets around it aren't needed; you could instead use: \ball\b].
(Note: Each Rule can only have at most one "filter:" parameter and one "regexFilter" parameter. You can either separate each word with the pipe symbol, or create another Rule).
If there are additional words that you'd like added as default "smart" filters, I can look at adding those in a future release (you can build your own via RegEx expressions as well, but I may be able to come up with more powerful rules - more powerful than RegEx alone potentially - since the built-in rules can have additional logic programmed into them).
-
View User Profile
-
Send Message
Posted Feb 4, 2013I just don't understand how to add new words, I tried this but is probably wrong:
- filter: MyCuteWord,MyCuteWord2
But I get a UNKOWN STANDARD FILTER: 'MyCuteWord', what did I miss?
-
View User Profile
-
Send Message
Posted Feb 2, 2013An updated version (currently being tested against the latest bukkit release) is coming soon that will:
-
View User Profile
-
Send Message
Posted Jan 28, 2013If you change the Rule's "bumpcount" to "0", then when that Rule is violated (i.e., a swear is found) the Player's warnings will never get bumped up (maybe I needed a better name for that parameter), so they'd never reach their maxwarnings and would never get banned.
I'll add an option in a future version to configure what to do (if anything) if/when the maximum number of warnings has been reached (and/or allow that mechanism to be explicitly disabled).
-
View User Profile
-
Send Message
Posted Jan 28, 2013IS there the ability to turn off automatic banning? This is a plugin I would like to use, unless it automatically bans. I don;t want anything happening automatically like that.