Security Features

PrimeChat provides comprehensive security features to protect your server's chat environment from spam, inappropriate content, and advertising.

Anti-Spam System

Configuration

security:
  anti-spam:
    enabled: true
    cooldown: 3  # seconds between messages

How It Works

  • Cooldown Timer: Players must wait between messages

  • Individual Tracking: Each player has their own cooldown

  • Memory Storage: Cooldowns are stored in memory for performance

  • Bypass Permission: primechat.bypass.spam allows trusted players to skip cooldown

Features

  • Real-time Feedback: Players see remaining cooldown time

  • Configurable Duration: Set cooldown from 1-60 seconds

  • Staff Exemption: Admins and mods can be exempted

  • No Message Loss: Blocked messages aren't sent but inform the player

Blocked Words Filter

Configuration

security:
  blocked-words:
    enabled: true
    words:
      - "badword1"
      - "badword2"
      - "inappropriate"

Filter Features

  • Case Insensitive: Catches all variations (BadWord, BADWORD)

  • Instant Blocking: Messages containing blocked words aren't sent

  • Bypass Permission: primechat.bypass.blockedwords for trusted users

  • Custom Word List: Add unlimited blocked words

Best Practices

  • Use lowercase for consistency

  • Include common variations of words

  • Consider abbreviations and alternative spellings

  • Regularly update the list based on server needs

Anti-Advertising Protection

Configuration Options

security:
  anti-advertising:
    enabled: true
    block-ipv4: true      # Block IP addresses
    block-domains: true   # Block domain names  
    block-links: true     # Block web links

Detection Types

IPv4 Address Detection

  • Blocks patterns like: 192.168.1.1, 123.456.789.0

  • Uses regex pattern matching

  • Catches various IP formats

Domain Name Detection

  • Blocks patterns like: example.com, server.net

  • Detects common TLDs (.com, .net, .org, etc.)

  • Prevents server advertising

  • Blocks full URLs: http://example.com, https://site.org

  • Catches common link formats

  • Includes shortened URLs

Detection Locations

Configure where advertising detection occurs:

security:
  anti-advertising:
    detection:
      chat: true      # Public chat messages
      commands: true  # Command arguments
      signs: true     # Sign text content

Advanced Features

  • Bypass Permission: primechat.bypass.advertising

  • Custom Messages: Configurable warning messages

  • Whitelisting: Allow specific domains if needed

  • Logging: Track advertising attempts

Chat Lock System

Usage

  • Lock Chat: /chat lock - Restricts chat to bypass users only

  • Unlock Chat: /chat unlock - Returns chat to normal

  • Status Check: Chat lock status is stored in configuration

Configuration

security:
  chat-lock:
    is-locked: false  # Current lock status

Permissions

  • primechat.lock - Lock the chat

  • primechat.unlock - Unlock the chat

  • primechat.bypass.lock - Speak when chat is locked

Visual Feedback

Players see centered messages when chat is locked/unlocked:

  • "Chat is now locked!"

  • "Chat is now unlocked!"

  • "Chat is currently locked" (when trying to speak)

Security Integration

With Other Plugins

PrimeChat security works alongside:

  • LiteBans: Chat violations can trigger bans

  • AdvancedBan: Integration with punishment systems

  • CoreProtect: Chat logging for investigation

  • WorldGuard: Region-based chat restrictions

Staff Tools

Social Spy

  • Monitor all private messages

  • Toggle with /chat spy [on/off]

  • See formatted spy messages

  • Essential for moderation

Message Logging

  • All messages logged with timestamps

  • Includes sender, receiver, and content

  • Useful for investigations

  • Stored in plugin data folder

Performance Optimizations

  • Efficient Pattern Matching: Optimized regex for advertising detection

  • Memory Management: Cooldown cleanup prevents memory leaks

  • Async Processing: Heavy operations don't block main thread

  • Caching: Permission checks are cached for performance

Configuration Examples

High Security Server

security:
  anti-spam:
    enabled: true
    cooldown: 5
  blocked-words:
    enabled: true
    words:
      - "grief"
      - "hack"
      - "cheat"
  anti-advertising:
    enabled: true
    block-ipv4: true
    block-domains: true
    block-links: true
    detection:
      chat: true
      commands: true
      signs: true

Casual Server

security:
  anti-spam:
    enabled: true
    cooldown: 2
  blocked-words:
    enabled: false
  anti-advertising:
    enabled: true
    block-ipv4: false
    block-domains: true
    block-links: true
    detection:
      chat: true
      commands: false
      signs: false

Troubleshooting

Common Issues

  1. False Positives: Legitimate messages blocked

    • Solution: Review word lists and regex patterns

    • Add bypass permissions for trusted users

  2. Performance Impact: Server lag during chat

    • Solution: Optimize word lists and detection patterns

    • Consider disabling heavy features on large servers

  3. Staff Complaints: Moderators can't bypass restrictions

    • Solution: Grant appropriate bypass permissions

    • Use permission inheritance for staff groups

Last updated