Filters

The chat/filters.yml file defines rules for monitoring and controlling player chat messages.

Filter Types

SolarityChat supports several types of filters to protect your server's chat:

  • BLOCKED_WORDS: Matches specific words and phrases.
    • smart-filter: Set to true to detect variations and bypass attempts (e.g., using numbers like 3 instead of e).
    • fuzzy-matching: Set to true to match words that are similar to the blocked word.
    • fuzzy-threshold: A value between 0.0 and 1.0 (default 0.85).
  • REGEX: Use advanced regular expressions to match complex patterns like URLs or IP addresses.
  • CAPS: Prevents players from using too many capital letters in a single message.
    • threshold: The percentage of capital letters that will trigger the filter (e.g., 0.7 for 70%).
    • min-length: The minimum message length required for the filter to activate.
  • SPAM_CHARACTERS: Detects and limits the same character being repeated many times (e.g., Heeeeeeelp).
    • max-consecutive: The maximum number of times a single character can be repeated.

Filter Actions

When a filter is triggered, you can define one or more actions to perform:

  • CANCEL_EVENT: Prevents the message from appearing in chat.
  • MESSAGE:&cYour Message: Sends a custom message to the player who triggered the filter.
  • NOTIFY_STAFF: Sends an alert to all online staff members with the solaritychat.toggle-alerts permission.
  • DISCORD_WEBHOOK: Sends a detailed alert to your Discord server via the configured webhook.
  • RUN_COMMANDS:[command1, command2]: Executes one or more server commands. Use the %player% placeholder for the player's name.

Example Filter:

swearing:
  enabled: true
  type: "BLOCKED_WORDS"
  smart-filter: true
  words:
    - "badword1"
    - "badword2"
  actions:
    - "CANCEL_EVENT"
    - "MESSAGE:&cPlease keep the chat clean!"
    - "NOTIFY_STAFF"
    - "RUN_COMMANDS:[warn %player% Swearing]"