ChatModer is a lightweight AI chat moderation plugin for Paper 1.21 that combines regex filtering with optional offline ONNX models to block toxic and harmful messages all without paid APIs.
A lightweight, free, AI-assisted chat moderation plugin for Paper 1.21 Minecraft servers. ChatMod combines fast regex/language filtering with an optional offline ONNX-based classifier to accurately moderate toxic, hateful, sexual, and harassing messages without paid APIs.
ChatModer.jar into your server plugins/ directoryplugins/ChatModer/config.ymlplugins/ChatModer/models/ and point the config to the ONNX fileChatModer supports Hugging Face RoBERTa ONNX models, e.g. protectai/unbiased-toxic-roberta-onnx.
Create a folder like:
plugins/ChatModer/models/unbiased-toxic-roberta-onnx/
Put these files inside:
model_quantized.onnx (recommended) or model.onnxconfig.json (contains id2label/label2id)tokenizer.json (preferred), or vocab.json + merges.txttokenizer_config.json, special_tokens_map.jsonConfig snippet:
moderation:
ai:
enabled: true
model_path: plugins/ChatModer/models/unbiased-toxic-roberta-onnx/model_quantized.onnx
max_sequence_length: 128
async_threads: 2
timeout_ms: 500
The tokenizer/config are auto-loaded from the same folder as the ONNX.
obscene -> profanityinsult/threat -> harassmentsexual_explicit -> sexualidentity_attack -> hatetoxicity/severe_toxicity boost profanity/harassment slightlyblack, muslim) are not flagged by themselves; they serve as context when combined with insult/toxicitymoderation.ai.weightmoderation:
enabled: true
mode: hybrid # regex | ai-only | hybrid
ai:
enabled: true
weight: 0.8
Stats are persisted to SQLite by default or MySQL if configured. The plugin can auto-migrate existing SQLite stats to MySQL.
database:
type: sqlite
sqlite_file: plugins/ChatModer/data.db
mysql:
host: 127.0.0.1
port: 3306
database: chatmoder
user: root
password: "secret"
useSSL: false
sqlite_migrate_file: plugins/ChatModer/data.db
stats:
autosave_seconds: 300
Fine-tune moderation sensitivity and actions per category.
thresholds:
profanity: 0.7
harassment: 0.6
hate: 0.6
sexual: 0.7
spam: 0.8
punishments:
profanity: block # warn | tempmute | kick | tempban | block | command:<cmd>
harassment: warn
hate: tempmute
sexual: block
spam: block
plugins/ChatModer/logs/flags.logflags table (optional)/chatmod review <player> reads from DB if enabled, else file logs. Supports legacy pretty-printed logs and compact JSONL./chatmod toggle — Enable/disable moderation./chatmod status — Live stats overview./chatmod review <player> — Review recent flagged messages./chatmod whitelist add|remove <word> — Manage whitelist./chatmod strict reload — Reload strict list./chatmod train add|capture|fromlog|words|stats|export — Dataset tools./chatmod stats reset confirm — Clear in-memory stats and persist immediately.dataset.jsonl ready for fine-tuningAll tools are available under /chatmod train ....
For immediate blocks (e.g., high-severity tokens), enable strict rules and reload them without a restart:
/chatmod strict reload
chatmod.admin — Access to admin commandschatmod.bypass — Bypass moderationchatmod.review — Access review toolsAll processing is local. No external API calls are made unless you enable webhooks.
moderation.ai.model_path and ensure config.json and tokenizer.json (or vocab.json + merges.txt) are in the same directory.moderation.ai.timeout_ms or reduce max_sequence_length.model_quantized.onnx and keep max_sequence_length at 128/256.Open an issue on the project repository with logs, configs, and steps to reproduce. Provide model details if you use a custom model.