Usage Examples

WARNING: OFFENSIVE LANGUAGE

This page contains language that may be offensive to some people!

This includes swears as well as crude and sexually explicit language. If you may be offended by this language, please leave this page now.


Pre-built Smart Filters:

The current version of the software contains eleven (11) built-in "Smart Filters", and allows custom "regular expression" filters to be created as well. The built-in filtered words (including many variants of them) are:

  • fuck
  • shit (also includes a very basic filter for scheiss/scheisse/scheiße).
  • ass
  • bastard
  • bitch
  • cock
  • cunt
  • dick
  • damn
  • nigger
  • ipaddress (detects IPv4 Internet addresses; useful for filtering on server advertising)

To use a built-in "Smart Filter", configure your Rule using the "filter:" keyword (separating each "Smart Filter" name by a comma).
Example:

 - filter: fuck, shit, bitch


The default "filters.yaml" file also includes an example of some fairly basic custom regex filtering for the following words: douche, fag, slut, whore, cum, handjob, blowjob, dildo, jackoff, pecker, penis, and boner. You can also add your own custom filtered regex words (and/or remove any of the default ones). See below for more details.

You can test out the accuracy of the currently running filters (and/or verify which word variations are included) from the bukkit console via the following command:

yasf test <word or sentence to test>

Actions:

When a filtered word is detected, the command is blocked. In addition, you may define specific Actions to happen to the offending player when a violation occurs. The following built-in Actions currently exist:

ActionDescription
kickkicks a player off of the site
killkills a player (sets his health to zero)
burnsets the player on fire for a few seconds
banbans the player
deopde-ops a player (if they were an operator to begin with)
burnsets the player on fire for a few seconds
message: <message>sends a message to the player
cmd: <command>execute a minecraft/bukkit/plugin command.
bumpcount: <number>increments the warnings / de-merit count by the given number (e.g., 0.5, 1, 2, etc.)
resetWarningsresets the number of de-merits that a player has to zero

Multiple custom commands ("cmd:") can be included in a single Rule/Action-list. To substitute the offending player's name in the command, use: <player>
For example:

actions:
   - bumpcount: 1
   - message: "Please no swearing on this site."
   - cmd: jail <player> 180
   - cmd: tell <player> You've been jailed!

*note: the custom command you specify (e.g., "jail <player> 180") must be available on your server, either as a built-in bukkit command, or as a command provided by another plugin.

Although the "cmd:" Action can do most of what the other built-in Actions can do, there is a difference: many of the built-in Actions only occur after a short delay (like "kick" and kill, for example), to give the player a few seconds to potentially read a message sent to them explaining why they're being kicked or killed (to continue with the previous Action examples). Currently the "cmd:" Action is executed immediately.

In addition, the built-in Actions may be easier to configure for some people than defining a custom one (also, the "cmd:" Action was added after the other built-in Actions, so they're still there for backward compatibility reasons).

Custom RegEx Filters:

To define your own list of words to filter on, 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!

For 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 another 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 the "\b" aren't needed; you could instead use: \ball\b].

As a last example, to include multiple words in a single filter separate each word with a pipe ("|") symbol, which acts like an "OR" in RegEx:

 - regexFilter: ([s$]+o+c*k+)|(\ball\b)

[Again, the brackets around each word definition aren't needed, and are only included here to more clearly separate each definition].

Tips & Tricks

You can detect more than just swear words with RegEx. Any word, sentence, or combination of characters can be matched with a custom regexFilter. Currently YASF performs case-insensitive pattern matching (which means it doesn't care whether or not lower-case or upper-case letters are used).

There are many RegEx tutorials on the web which go into more of the options available, including:

There are also mutiple online RegEx testers, which you can use to verify that your regular expression actually works. These include:

Note 1: Each Rule can only have at most one "filter:" parameter (which can have multiple smart filters defined configured for it), and one user-created "regexFilter" parameter.


Comments

Posts Quoted:
Reply
Clear All Quotes