XTextsCensor icon

XTextsCensor 1.0.6

Comprehensive and highly customizable text filtering solution for any type of server!

Supported Java version: 8+

XTexts-Censor-big-logo.png
XTextsCensor is an incredibly efficient plugin with a sophisticated text filtering system for your server. It can be used to fully automate the filtering of text that players write in chat, in an anvil, on sign and when editing books.
A necessary plugin for any type of server - from a regular lobby to a faction server!

There is no "special magic" or neural networks in the plugin - most filters use regex patterns to detect and filter the text you want. This makes the plugin filters a powerful, highly customizable system that, if properly and carefully configured, can recognize 100% of unwanted text!


[dropdown=More details][/dropdown]

Out of the box, the plugin has 6 filters available - a swear filter, an ip address filter, a domain filter, a special utf-8 character filter, a word replacement filter and a CAPS filter.
Naturally, each filter has its own whitelist - a set of words or regexp expressions that will be completely ignored when checking the text.
Also, for each filter there are customizable permissions for receiving notifications or ignoring the player when the filter is running.


Soft dependencies

[dropdown=PlaceholderAPI]

Linkhttps://www.spigotmc.org/resources/placeholderapi.6245/

With this plugin, you can use placeholders in punishment actions.

You can also use

%textscensor_{filter_identifier}_violation_level%
%textscensor_Replace_violation_level% # for example

placeholder to receive violation level of player for certain filter.[/dropdown]

Automatic punishment system

The reaction of each of the filters to a particular event can be configured in detail as you need. Also, each filter has a very finely configurable section of automatic punishments that will be applied if the filter detects the search text.

[dropdown=Scheme of work]

Filters-scheme.png

[/dropdown]

Violations:
  ALL:
    '1':
      Event-result:
        Type: REMOVE_DETECTED
        Priority: 3
      Punishments:
      - "[LOG | WARNING] '{player_name}' uses restricted symbols: '{emphasized_message}'"
      - "[NOTIFY] §7'§c{player_name}§7' uses §crestricted symbols§7: ' {emphasized_message}§7'."
    '2':
      Event-result:
        Type: REMOVE_DETECTED
        Priority: 3
      Punishments:
      - "[LOG | WARNING] '{player_name}' uses restricted symbols: '{emphasized_message}'"
      - "[NOTIFY] §7'§c{player_name}§7' uses §crestricted symbolsp§7: '{emphasized_message}§7'."
[dropdown=Section parsing]

* List of check types.
Appropriate penalties are applied depending on the type of inspection.
For example, when writing an IP address in the chat, penalties with the CHAT type in the filter for IP addresses will be applied.
Possible options:
COMMAND - for commands only


CHAT - for chat only

SIGN - for signs only

ANVIL - for anvils only

BOOK - only for books

ALL - for all types of checks
* Punishment levels.
When the list of punishments for the player is executed, its level increases by 1. For each punishment level, you can indicate your actions and the result of the event.
* Event-result.
Possible options:
- NOTHING - no reaction to the event.
- SHOW_ONLY_SENDER (works only for chat) - sending a message only to the sender, no one else will see the message.
- REMOVE_DETECTED - removes the found text, replacing it with the text specified in the filter ('*' in the default settings).
- CANCEL_EVENT - cancels the event.
- REMOVE_STACK (only works for books and anvils) - removes the item. (a book or item in an anvil).
* Event-result priority
When checking the text, several filters can react at once - in this case, the punishment section of each filter is executed separately. It is also necessary to get the result of the called event, and for this the priority is used. The plugin receives all possible event results from all filters, finds the result with the highest priority, and executes it. If the plugin finds results with the same priority, then the event result is randomly determined between them.
* Punishments - a list of actions performed during punishment.
| Consists of a string that consists of two parts. In the first part, the type of action and its parameters are indicated in square brackets.
Possible options:
- COMMAND
Runs a command on behalf of a player or console.
Format:


- "[COMMAND] {command}" # the command will be executed on behalf of the console if SENDER is not specified
- "[COMMAND | {SENDER}] {command}"
# {SENDER} - on whose behalf the command is being executed, can be PLAYER or CONSOLE.
# {command} - command and its parameters.
- MESSAGE
Sends a message to the player (or all players on the server).
Format:


- "[MESSAGE] {message}"
- "[MESSAGE | BROADCAST] {message}"
# '| BROADCAST '- when specified, sends a message to all players on the server.
# {message} - message.
- NOTIFY
Sends a message to all players on the server with a special filter permission.
Format:


- "[NOTIFY] {message}"
# {message} - message.
- PLAY_SOUND
Plays sound to the player (or to all players on the server).
Format:


- "[PLAY_SOUND] {sound}"
- "[PLAY_SOUND | VOLUME: {volume}] {sound}"
- "[PLAY_SOUND | VOLUME: {volume} | PITCH: {pitch}] {sound}"
- "[PLAY_SOUND | VOLUME: {volume} | PITCH: {pitch} | BROADCAST] {sound}"
- "[PLAY_SOUND | VOLUME: {volume} | BROADCAST] {sound}"
- "[PLAY_SOUND | PITCH: {pitch} | BROADCAST] {sound}"
- "[PLAY_SOUND | PITCH: {pitch}] {sound}"
- "[PLAY_SOUND | BROADCAST] {sound}"
# {volume} - sound volume.
# {volume} - sound volume.
# {pitch} - tone of the sound.
# '| BROADCAST '- when specified, plays sound to all players on the server.
# {sound} - sound name.
- LOG
Sends a message to the server console.
Format:


- "[LOG] {message}" # Level.INFO will be used if no level is specified
- "[LOG | {level}] {message}"
# {level} - recording level.
# Possible options: OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL.
# {message} - message.

[/dropdown]

All punishments of the players are stored in memory for 6 hours after recording and are deleted when the server is restarted.


Filters configuration

The basic configuration looks like this:

[dropdown=Basic filters configuration]

# Welcome to filter configuration :)
# Let's start with basic things:
# Here we have filters - '',
# Possible filter objects: Caps Filler, RegexFilter.
# Emphasize colors - colors to underline words found by the filter.
# Event results - what result will be applied to the triggered event if the filter hit the text.
# Has a format: 
#  :
#    'violation level': ' : '
# The 'filter check type' types specified in 'event results' section
# will activate the filter for that event.
# The 'event result priority' is used to calculate the final result for the event.
# The lower the priority, the higher the chance that this result will be used in the end.
# If different filters for the same filter check type use the same priority
# for the event result, the result will be selected randomly.
Filters:
  Replace:
    ==: ReplaceFilter
    Violations:
      CHAT:
        '1':
          Event-result:
            Type: REMOVE_DETECTED
            Priority: 2
    Emphasizes:
      Whitelist:
        Start: §9§n
        End: §7
    Regex-pattern:
    - \b(idk)\b:i don't know
    Permissions:
      Notify: texts.censor.replace.notify
      Bypass: texts.censor.replace.bypass
    Enabled: true
  IP:
    ==: RegexFilter
    Regex-patterns:
      Whitelist:
        Regex: 127.0.0.1:25565
        Flags:
        - CASE_INSENSITIVE
      Blacklist:
        Regex: ((\d+\W{1,5}){2,}\d+)
        Flags:
        - CASE_INSENSITIVE
    Violations:
      ALL:
        '1':
          Event-result:
            Type: REMOVE_DETECTED
            Priority: 2
          Punishments:
          - '[LOG | WARNING] ''{player_name}'' publishes unknown ip: ''{emphasized_message}'''
          - '[NOTIFY] §7''§c{player_name}§7'' publishes unknown §cip§7: ''{emphasized_message}§7'''
        '2':
          Event-result:
            Type: REMOVE_DETECTED
            Priority: 2
          Punishments:
          - '[LOG | WARNING] ''{player_name}'' publishes unknown ip: ''{emphasized_message}§7'''
          - '[NOTIFY] §7''§c{player_name}§7'' publishes unknown §cip§7: ''{emphasized_message}§7'''
    Emphasizes:
      Whitelist:
        Start: §a§n
        End: §7
      Blacklist:
        Start: §c§n
        End: §7
    Permissions:
      Notify: texts.censor.ip.notify
      Bypass: texts.censor.ip.bypass
    Single-char-replacement: true
    Enabled: true
    Replacement: '*'
  Swear:
    ==: SwearFilter
    Regex-patterns:
      Whitelist:
        Pattern:
          ==: RegexPattern
          Regex: ({regexes})
          Flags:
          - CASE_INSENSITIVE
        List:
        - any_whitelisted_word_can_be_here
      Blacklist:
        Pattern:
          ==: RegexPattern
          Regex: ({regexes})
          Flags:
          - CASE_INSENSITIVE
        List:
        - ((f+)[ua4]+?(c+)?(k+))
        - ((b+)[i1]+?(t+)?(c+)?(h+))
    Violations:
      ALL:
        '1':
          Event-result:
            Type: REMOVE_DETECTED
            Priority: 2
          Punishments:
          - '[LOG | WARNING] ''{player_name}'' uses swear in his messages: ''{emphasized_message}'''
          - '[NOTIFY] §7''§c{player_name}§7'' uses §cswear §7in his messages: ''{emphasized_message}§7'''
        '2':
          Event-result:
            Type: REMOVE_DETECTED
            Priority: 2
          Punishments:
          - '[LOG | WARNING] ''{player_name}'' uses swear in his messages: ''{emphasized_message}'''
          - '[NOTIFY] §7''§c{player_name}§7'' uses §cswear §7in his messages: ''{emphasized_message}§7'''
    Emphasizes:
      Whitelist:
        Start: §a§n
        End: §7
      Blacklist:
        Start: §c§n
        End: §7
    Permissions:
      Notify: texts.censor.swear.notify
      Bypass: texts.censor.swear.bypass
    Single-char-replacement: true
    Enabled: true
    Replacement: '*'
  Domain:
    ==: RegexFilter
    Regex-patterns:
      Whitelist:
        Regex: your-project-domain.com
        Flags:
        - CASE_INSENSITIVE
      Blacklist:
        Regex: ([0-9a-z]{2,}\.)+(рус|pф|space|abb|abc|able|ac|aco|ad|adac|ads|ae|aeg|aero|af|afl|ag|art|asia|at|auto|aw|aws|ax|axa|az|ba|baby|band|bank|bar|bb|bbc|bbt|bbva|bcg|bcn|bd|be|beer|best|bet|bf|bg|bh|bi|bid|bike|bing|bio|biz|bj|blog|blue|bm|bms|bmw|bn|bnl|bo|bofa|bom|bond|boo|book|bot|br|bs|bt|buy|buzz|bv|bw|by|bz|bzh|ca|cab|cafe|cal|call|cam|camp|car|care|cars|casa|case|cash|cat|cba|cbn|cbre|cbs|cc|cd|ceb|ceo|cern|cf|cfa|cfd|cg|ch|chat|ci|citi|city|ck|cl|club|cm|cn|com|cool|coop|cr|crs|csc|cu|cv|cw|cx|cy|cyou|cz|dad|date|day|dclk|dds|de|deal|dell|desi|dev|dhl|diet|dish|diy|dj|dk|dm|dnp|do|docs|dog|doha|dot|dtv|duck|duns|dvag|dvr|dz|eat|ec|eco|edu|ee|eg|er|erni|es|esq|eu|eus|fage|fail|fan|fans|farm|fast|fi|fiat|fido|fire|fish|fit|fj|fk|flir|fly|fm|fo|foo|ford|fox|fr|frl|ftr|fund|fyi|ga|gal|game|gap|gb|gbiz|gd|gdn|ge|gea|gent|gf|gg|ggee|gh|gi|gift|gl|gle|gm|gmbh|gmo|gmx|gn|gold|golf|goo|goog|gop|got|gov|gp|gq|gr|gs|gt|gu|guge|guru|gw|gy|haus|hbo|hdfc|help|here|hgtv|hiv|hk|hkt|hm|hn|host|hot|how|hr|hsbc|ht|htc|hu|ibm|icbc|ice|icu|id|ie|ieee|ifm|il|im|imdb|immo|in|info|ing|ink|int|io|iq|ir|is|ist|it|itau|itv|iwc|java|jcb|jcp|je|jeep|jlc|jll|jm|jmp|jnj|jo|jobs|jot|joy|jp|jprs|kddi|ke|kfh|kg|kh|ki|kia|kim|kiwi|km|kn|kp|kpmg|kpn|kr|krd|kred|kw|ky|kz|la|land|lat|law|lb|lc|lds|lego|lgbt|li|lidl|life|like|limo|link|live|lk|loan|loft|lol|love|lpl|lr|ls|lt|ltd|ltda|lu|luxe|lv|ly|ma|maif|man|mba|mc|mcd|md|me|med|meet|meme|men|menu|meo|mg|mh|mil|mini|mint|mit|mk|ml|mlb|mls|mm|mma|mn|mo|mobi|moda|moe|moi|mom|mov|mp|mq|mr|ms|msd|mt|mtn|mtpc|mtr|mu|mv|mw|mx|my|mz|nab|name|navy|nba|nc|ne|nec|net|new|news|next|nf|nfl|ng|ngo|nhk|ni|nico|nike|nl|no|now|np|nr|nra|nrw|ntt|nu|nyc|nz|obi|off|ollo|om|ong|onl|ooo|open|org|ott|ovh|pa|page|pars|pay|pccw|pe|pet|pf|pg|ph|pics|pid|pin|ping|pink|pk|pl|play|plus|pm|pn|pnc|pohl|porn|post|pr|pro|prod|prof|pru|ps|pt|pub|pw|pwc|py|qa|qpon|qvc|raid|re|read|red|reit|ren|rent|rest|rich|rio|rip|ro|room|rs|rsvp|ru|ruhr|run|rw|rwe|sa|safe|sale|sap|sapo|sarl|sas|save|saxo|sb|sbi|sbs|sc|sca|scb|scor|scot|sd|se|seat|seek|ses|sew|sex|sexy|sfr|sg|sh|shaw|shia|shop|show|si|silk|sina|site|sj|sk|ski|skin|sky|sl|sm|sn|sncf|so|sohu|song|sony|soy|spot|sr|srl|srt|st|star|stc|su|surf|sv|sx|sy|sz|tab|talk|tax|taxi|tc|tci|td|tdk|team|tech|tel|teva|tf|tg|th|thd|tiaa|tips|tj|tjx|tk|tl|tm|tn|top|town|toys|tr|trv|tt|tube|tui|tv|tvs|tw|tz|ua|ubs|ug|uk|uno|uol|ups|us|uy|uz|va|vana|vc|ve|vet|vg|vi|xyz|store|vig|vin|vip|visa|viva|vivo|vn|vote|voto|vu|wang|wed|weir|wf|wien|wiki|win|wine|wme|work|wow|ws|wtc|wtf|xbox|xin|xxx|ye|yoga|you|yt|yun|za|zara|zero|zip|zm|zone|zw|online)(:\d*)?
        Flags:
        - CASE_INSENSITIVE
    Violations:
      ALL:
        '1':
          Event-result:
            Type: REMOVE_DETECTED
            Priority: 2
          Punishments:
          - '[LOG | WARNING] ''{player_name}'' publishes unknown domain: ''{emphasized_message}'''
          - '[NOTIFY] §7''§c{player_name}§7'' publishes unknown §cdomain§7: ''{emphasized_message}§7'''
        '2':
          Event-result:
            Type: REMOVE_DETECTED
            Priority: 2
          Punishments:
          - '[LOG | WARNING] ''{player_name}'' publishes unknown domain: ''{emphasized_message}'''
          - '[NOTIFY] §7''§c{player_name}§7'' publishes unknown §cdomain§7: ''{emphasized_message}§7'''
    Emphasizes:
      Whitelist:
        Start: §a§n
        End: §7
      Blacklist:
        Start: §c§n
        End: §7
    Permissions:
      Notify: texts.censor.domain.notify
      Bypass: texts.censor.domain.bypass
    Single-char-replacement: true
    Enabled: true
    Replacement: '*'
  Special-symbols:
    ==: RegexFilter
    Regex-patterns:
      Whitelist:
        Regex: 
        Flags:
        - CASE_INSENSITIVE
      Blacklist:
        Regex: '[^\wA-z!@"''#№$:;%.,<>^*()-=+\|~`{}&§? ]'
        Flags:
        - CASE_INSENSITIVE
    Violations:
      ALL:
        '1':
          Event-result:
            Type: REMOVE_DETECTED
            Priority: 3
          Punishments:
          - '[LOG | WARNING] ''{player_name}'' uses restricted symbols: ''{emphasized_message}'''
          - '[NOTIFY] §7''§c{player_name}§7'' uses §crestricted symbolsp§7: ''{emphasized_message}§7'''
        '2':
          Event-result:
            Type: REMOVE_DETECTED
            Priority: 3
          Punishments:
          - '[LOG | WARNING] ''{player_name}'' uses restricted symbols: ''{emphasized_message}'''
          - '[NOTIFY] §7''§c{player_name}§7'' uses §crestricted symbolsp§7: ''{emphasized_message}§7'''
    Emphasizes:
      Whitelist:
        Start: §a§n
        End: §7
      Blacklist:
        Start: §c§n
        End: §7
    Permissions:
      Notify: texts.censor.special-symbols.notify
      Bypass: texts.censor.special-symbols.bypass
    Single-char-replacement: true
    Enabled: true
    Replacement: '*'
  Caps:
    ==: CapsFilter
    Caps-maximum-percent: 35
    Violations:
      ALL:
        '1':
          Event-result:
            Type: REMOVE_DETECTED
            Priority: 5
          Punishments:
          - '[LOG | WARNING] ''{player_name}'' uses CAPS LOCK extensively: ''{emphasized_message}§7'''
          - '[MESSAGE] §7You received your §cfirst warning §7for using CAPS LOCK!'
          - '[NOTIFY] §7''§c{player_name}§7'' uses §cCAPS LOCK §7extensively: ''{emphasized_message}§7'''
        '2':
          Event-result:
            Type: REMOVE_DETECTED
            Priority: 5
          Punishments:
          - '[LOG | WARNING] ''{player_name}'' uses CAPS LOCK extensively: ''{emphasized_message}§7'''
          - '[MESSAGE] §7You received your §csecond warning §7for using CAPS LOCK!'
          - '[NOTIFY] §7''§c{player_name}§7'' uses §cCAPS LOCK §7extensively: ''{emphasized_message}§7'''
    Message-minimum-length: 5
    Emphasizes:
      Whitelist:
        Start: §a§n
        End: §7
      Blacklist:
        Start: §c§n
        End: §7
    Permissions:
      Notify: texts.censor.caps.notify
      Bypass: texts.censor.caps.bypass
    Enabled: true
    Whitelist:
    - ESIC
    Forcibly-uppercase-whitelisted-words: false
    Remove-mode: SENTENCE_START_WITH_CAPITAL_LETTER
    Consider-words-used-in-whitelist-when-calculating-caps-percent: false
    Message-end-characters:
    - .
    - '!'
    - '?'
[/dropdown]

and already contains settings for the CAPS filter, utf-8 special characters filter, domain filter, an example of organizing regex patterns for a swear filter and settings for ip-addresses.


Screenshots and GIF's
[dropdown]

bandicam-2021-03-03-19-51-37-389_1.gif
[/dropdown]

Commands and permissions
[] | <> required and optional arguments.


- '/textscensor ' [Alias: /tc] - prints all plugin commands.

Permission: texts.censor.commands.help

- '/tc reload' - reloads plugin configurations.

Permission: texts.censor.commands.reload

- '/tc filters' - displays all loaded filters and their status.

Permission: texts.censor.commands.filters

- '/tc enable [filter identifier]' - enables the filter.

Permission: texts.censor.commands.filter.enable

- '/tc disable [filter identifier]' - disables the filter.

Permission: texts.censor.commands.filter.disable

- '/tc debug' - toggle debug mode.

Permission: texts.censor.commands.debug

- '/tc check [check type] [text]' - reloads plugin configurations.

Permission: texts.censor.commands.check

For any errors or suggestions, write to the discussion section.
If you use XTextsCensor and you like it, please rate and leave a review about it!