Welcome to the Hangar Open Beta. Please report any issue you encounter on GitHub!
Avatar for NBTArchives

Chat Filter is a simple yet highly configurable plugin that uses regex to scan and handle messages. It can support an un

Report Chat_Filter?

Chat Filter

About

Chat Filter is a simple yet highly configurable plugin that uses regex to scan and handle messages. It can support an unlimited number of patterns in an unlimited number of categories, each capable of executing commands and notifying the proper staff when a match is made.

Features:

  • Mute and unmute players
  • Unlimited filter categories
  • Unlimited Regex patterns per category
  • Execute commands based off which category was matched
  • Log filter violations with a discord weblink
  • Built-in profiler for optimisation
  • Wide compatibility with other chat plugins
  • Everything is configurable
config.yml
# Chat Filter by _txsla and NBT Archives
# This plugin uses MiniMessage to parse messaged


# For compatibility with other chat plugins
event-priority: normal

# [   REGISTER FILTER CATEGORIES ]
# Add a category here to register it
# The plugin will not recognize categories that are not listed here
# Permission 'chatfilter.filter.bypass' will bypass these filters
# It is recommended that you put more important categories first on the list.
# Messages are filtered from first category in this list to last, so if two filters both match the pattern [a-zA-Z]\.(\.com|\.net), only the one listed first will be triggered
# The 'gamersafer' list is the official list of GamerSafer.com
registered-categories:
  - 'gamersafer'
  - 'demo-websites'
  - 'demo-all_caps'


# [  SPAM LIMITER   ]
# Every time a player sends a message, it increments a counter
# Every x milliseconds that counter is decremented
# If a player hits the max messages on their counter, their messages are not shown to other players
# Permission `chatfilter.spam.bypass` will bypass this limiter
spam-limiter:
  enabled: true
  ghost: true # send player their own messages, so they do not know they are muted
  count-repeats: true # should repeat messages increment twice? ADD THIS LATER
  counter-ceiling: 5 # if a player's message counter goes above this number, their messages will be hidden to other players
  decrement-timer: 3000 # milliseconds between message counter decrements
  ghost-player: true # should we show the player their cancelled message, so they do not know they are currently muted?


# This is the message format sent to ghosted players.
# Can also be used to tell players to slow down
# Placeholders:
# %PLAYER% - player who sent the message
# %MESSAGE% - player's message
# %SERVER% - server that player is in
# %WORLD% - world that player is on
ghost-format: "[GHOSTED] <white><%PLAYER%> %MESSAGE%</white>"

# Server Mute settings
# Muted players' messages can not be s
mute:
  # should mods be required ot provide a reason?
  require-reason: true
  # show muted player's their messages
  ghost-player: true


# [   NOTIFY   ]
# Notify a player when someone triggers a filter
# Players with permission 'chatfilter.notify' will be notified
# Placeholders:
# %PLAYER% - violator's username
# %MESSAGE% - message that triggered the filter
# %CATEGORY% - filter category that got triggered
# %PATTERN% - regex pattern that matched
# %RECIPIENT% - player who is receiving the message
notify:
  enabled: false
  message: '<red>@%RECIPIENT% | %PLAYER% : %MESSAGE% </red>'
  # set hover to null to disable
  hover: '%CATEGORY%'


# logs violations
log:
  # Log Message Placeholders:
  # %PLAYER% - player that triggered the filter
  # %MESSAGE% - message that triggered the filter
  # %CATEGORY% - category of filter that got triggered
  # %PATTERN% - regex pattern that matched
  message-format: "%PLAYER% has violated filter %CATEGORY% with message %MESSAGE%"
  to-file: true
  to-discord: false
  webhook: "WEBHOOK URL"


# Should scan times be timed?
# Use this to optimise your regex patterns
profile: false


# enable debug console output
debug: false
filter.yml
# This filter uses regex to match messages and will not work if you set up your expressions correctly
# PATTERNS ARE CASE SENSITIVE, design your regex accordingly

# Resources:
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Cheatsheet
# https://regex101.com/


# Action tag allowed arguments:
# 'notify' - notify user as specified in config.yml under notify
# (only put one of the below per category)
# 'cancel' - cancel the message
# 'censor' - replaced the offending message with asterisks (slowest optimised)
# 'ghost' - return message to sender but hide message from other players
# 'ignore' - does not cancel or modify the message, but still runs the commands


# Placeholders for commands (case-sensitive)
# %PLAYER%     - offending player's username
# %UUID%       - offending player's UUID
# %MESSAGE%    - message that triggered the violation
# %WORLD%      - world that offending player was in
# %IP%         - player's IP address, useful for auto IP BANS


# You must add the category to the list in config.yml to enable
categories:
  # Name of category
  example:
    # Whether this category is enabled by default
    enabled: false
    # Action to be taken when violation occurs
    action:
      - 'cancel'
      - 'notify'
    # These commands are executed as console when a player triggers the filter
    commands:
      - '/ban %PLAYER%'
    # Regex patterns for the filter to match
    regex:
      - 'pattern-1'
      - 'pattern-2'
      - 'pattern-3'

  # You can add unlimited categories
  # This is an example category to block websites in chat
  demo-websites:
    enabled: false
    action:
      - 'cancel'
    commands:
      - '/chatfilter mute %PLAYER% 5m Chat Filter'
    regex:
      - 'https?://'
      - '[\w\d-]+\.(net|com|org)'
      - '[\d]+\.[\d]+\.[\d]+\.[\d]+'

  demo-all_caps:
    enabled: false
    action:
      - 'cancel'
    commands:
      - '/chatfilter mute %PLAYER% 1h Chat Filter'
    regex:
      - '^[A-Z\s]+$'

  # Coming Soon:
  # The GamerSafer Regex list cannot be modified as it uses GamerSafer's official list
  # If there are ever issues with this filter, please make an issue on ChatFilter's GitHub Page
  gamersafer:
    enabled: false
    action:
      - 'cancel'
      - 'notify'
    commands:
      '/mute %PLAYER% 1h'
    # How strict should the filter be?
    # low : only exact word matches will trigger the filter
    # medium : close matches will trigger the filter
    # high : highest
    strictness: 'low'

Support

If you stumble across any bugs, please create a support ticket.

Information

CategoryAdmin Tools
Published onApril 22, 2025
LicenseUnspecified
Downloads3
Stars1
Watchers1

Members