ChatManagement 2
适用于 Minecraft 1.21.x 的高级反垃圾邮件与聊天保护插件
ChatManagement 2 是对原版 ChatProtection 插件的完全重写,具有改进的垃圾邮件检测算法、更少的误报以及增强的性能。完全兼容 Folia 的区域基于线程机制。
? 主要功能
智能垃圾邮件检测
- 相似度匹配 - 使用改进的 Levenshtein 距离算法,即使存在拼写错误也能检测垃圾邮件
"hello everyone" 与 "helo everyone" → 如果过于相似则被拦截
- 可配置的相似度阈值(默认:80%)
- 基于长度的过滤可防止短消息出现误报
屏蔽词系统
- 智能模式匹配 - 自动检测混淆字符:
- 数字/符号替代 (Leetspeak):
f*ck, fvck, fu<k
- 字符替换:
@→a, $→s, 0→o, 3→e
- 空格技巧:
f u c k
- 特殊字符:
f.u.c.k, f-u-c-k
- 部分匹配控制 - 可选的部分单词屏蔽功能,并附带最小长度要求
- 误报预防 - 智能边界检测可防止屏蔽合法词汇
反垃圾邮件保护
- 重复内容预防 - 拦截重复发送的消息,支持可配置阈值
- 快速垃圾邮件检测 - 自动踢出在短时间内发送过多消息的玩家(默认:5秒内7条消息)
- 速率限制 - 按玩家进行基于时间的消息追踪
自动禁言系统
- 惯犯检测 - 自动禁言反复因垃圾邮件被踢出的玩家(默认:10分钟内3次踢出 = 禁言5分钟)
- 持久化存储 - 禁言状态在服务器重启后保留(数据库或 YAML 格式)
- 智能计时器 - 玩家断开连接时暂停计时,重新连接时恢复
- 可配置时长 - 完全自定义阈值和持续时间
私聊功能
- 内置命令 -
/msg, /w, /tell, /pm, /dm, /whisper
- 回复系统 - 使用
/r 和 /reply 快速回复
- 颜色自定义 - 私聊消息使用自定义颜色(默认:紫红色)
- 垃圾邮件防护 - 所有反垃圾邮件检查同样适用于私聊
- 禁言兼容性 - 可选设置,允许被禁言玩家接收(但不能发送)私聊消息
聊天增强
- 彩色消息 - 在消息前添加
> 以显示自定义颜色(默认:浅绿色)
- 静默拦截 - 当消息被拦截时可配置通知
- 权限绕过 - 受信任的玩家可跳过所有检查
- 自定义消息 - 所有插件消息均可自定义
技术优势
- 兼容 Folia - 完全支持区域基于线程机制
- 高性能 - 极低开销(每条消息不到1毫秒)
- 数据库支持 - 支持 SQLite 或 MySQL 用于持久化存储
- 热重载 - 执行
/cm reload 可在不重启服务器的情况下更新配置
- 全面日志记录 - 提供调试模式和详细模式以便故障排除
? 安装
- 下载最新的
ChatManagement2-1.0.0.jar
- 将其放入服务器的
plugins 文件夹中
- 启动/重启服务器
- 根据需要配置
plugins/ChatManagement2/config.yml
- 运行
/cm reload 应用更改
要求
- Minecraft 服务器:1.21.x(Paper、Folia 或兼容分支)
- Java:21 或更高版本
⚙️ 配置
基本设置
默认配置开箱即用效果良好,但您可以自定义所有内容:
# 核心垃圾邮件检测
settings:
similarity-threshold: 80 # 0-100%,数值越高越严格
message-history-size: 10 # 每个玩家跟踪的消息数量
# 重复消息拦截
duplicate-messages:
max-repeats: 2 # 允许重复2次后再拦截
cooldown-seconds: 30 # 在此时间后清除历史记录
# 快速垃圾邮件检测
anti-spam-kick:
enabled: true
message-threshold: 7 # 时间窗口内的消息数量达到此值即踢出
time-window-seconds: 5
# 对惯犯的自动禁言
auto-mute:
enabled: true
kick-threshold: 3 # 时间窗口内踢出次数达到此值即禁言
kick-window-minutes: 10
mute-duration-seconds: 300
高级配置
数据库设置
为了在大量禁言状态下获得更好的性能,请启用数据库存储:
SQLite(推荐大多数服务器使用):
database:
enabled: true
type: sqlite
MySQL(适用于大型服务器):
database:
enabled: true
type: mysql
mysql:
host: localhost
port: 3306
database: chatmanagement
username: your_username
password: your_password
屏蔽词
根据您的需要配置词过滤器:
blocked-words:
enabled: true
block-partial-matches: false # 防止误报
min-word-length: 4 # 部分匹配的最小单词长度
word-list:
- badword1
- badword2
自定义消息
所有消息均可自定义并切换开关:
messages:
notify-blocked-message: false # 静默拦截
blocked-message-notification: "&cYour message was blocked."
anti-spam-kick:
notify-player: true
kick-message: "&cYou have been kicked for spamming!"
auto-mute:
notify-player: true
mute-notification: "&cYou have been muted for &e{duration} &cseconds."
mute-message: "&cYou are muted. Time remaining: &e{time} &cseconds."
私聊
自定义私聊外观:
private-messaging:
enabled: true
message-color: "&d" # 紫红色
sent-format: "&7[&dYou &7-> &d{receiver}&7] &r{message}"
received-format: "&7[&d{sender} &7-> &dYou&7] &r{message}"
聊天颜色
启用彩色聊天功能:
chat-colors:
enabled: true
color-prefix: ">" # 输入 >message 以显示彩色文本
prefix-color: "&a" # 浅绿色
? 命令
主要命令
/chatmanagement 或 /cm - 插件主命令
/cm reload - 重新加载配置
/cm help - 显示帮助信息
/cm version - 显示插件版本
私聊功能
/msg <玩家> <消息> - 发送私聊消息
/w <玩家> <消息> - /msg 的别名
/tell <玩家> <消息> - /msg 的别名
/pm <玩家> <消息> - /msg 的别名
/dm <玩家> <消息> - /msg 的别名
/whisper <玩家> <消息> - /msg 的别名
/r <消息> - 回复上一条消息
/reply <消息> - /r 的别名
? 权限
chatmanagement.reload - 允许重新加载插件(默认:op)
chatmanagement.bypass - 绕过所有聊天限制(默认:op)
? 故障排除
误报过多
如果合法消息被阻止:
-
提高相似度阈值:
settings:
similarity-threshold: 85 # 数值越高越严格,误报越少
-
禁用部分单词匹配:
blocked-words:
block-partial-matches: false
-
增加最小消息长度:
duplicate-messages:
min-message-length: 5
消息未被拦截
如果垃圾信息仍然通过:
-
降低相似度阈值:
settings:
similarity-threshold: 75 # 数值越低,拦截的垃圾信息越多
-
降低反垃圾踢出阈值:
anti-spam-kick:
message-threshold: 5
-
启用调试模式:
settings:
debug: true
在控制台中查看检测信息。
数据库问题
如果数据库连接失败:
- 检查配置文件中的凭据
- 确保数据库已存在(针对 MySQL)
- 插件将自动回退到 YAML 存储
- 查看控制台以获取错误信息
? 性能
ChatManagement 2 旨在实现极低的性能影响:
- 平均开销:每条消息 <1ms
- 内存占用:典型服务器约为 2-5 MB
- 数据库查询:使用预处理语句进行优化
- 线程安全:完全兼容 Folia 的线程模型
? 与 ChatProtection 的区别
ChatManagement 2 是一次彻底的重写,带来了重大改进:
- 更高的准确性 - 改进了垃圾邮件检测,减少了误报
- 基于长度的过滤 - 防止拦截短小且合法的聊天消息
- 部分匹配控制 - 智能边界检测被屏蔽词汇
- 数据库支持 - 可选 SQLite/MySQL 以提升性能
- 增强的禁言系统 - 断开/重新连接时暂停/恢复
- 改进的配置 - 对所有功能提供更精细的控制
- 更好的文档 - 包含详尽的注释和示例
? 更新日志
v1.0.0(初始版本)
- ChatProtection 模组完全重写
- 改进了垃圾信息检测算法
- 支持数据库(SQLite/MySQL)
- 增强了带持久化功能的静音系统
- 提供了更丰富的配置选项
- 文档更加全面
- 兼容 Folia
- 减少了误报情况
- 性能优化
ChatManagement 2
Advanced Anti-Spam & Chat Protection Plugin for Minecraft 1.21.x
ChatManagement 2 is a complete rewrite of the original ChatProtection plugin, featuring improved spam detection algorithms, fewer false positives, and enhanced performance. Fully compatible with Folia's region-based threading.
? Key Features
Smart Spam Detection
- Similarity Matching - Detects spam even with typos using an improved Levenshtein distance algorithm
"hello everyone" vs "helo everyone" → Blocked if too similar
- Configurable similarity threshold (default: 80%)
- Length-based filtering prevents false positives on short messages
Blocked Words System
- Intelligent Pattern Matching - Automatically detects obfuscations:
- Leetspeak:
f*ck, fvck, fu<k
- Character substitutions:
@→a, $→s, 0→o, 3→e
- Spacing tricks:
f u c k
- Special characters:
f.u.c.k, f-u-c-k
- Partial Match Control - Optional partial word blocking with minimum length requirements
- False Positive Prevention - Smart boundary detection prevents blocking legitimate words
Anti-Spam Protection
- Duplicate Prevention - Blocks repeated messages with configurable threshold
- Rapid Spam Detection - Auto-kicks players sending too many messages too quickly (default: 7 msgs in 5 sec)
- Rate Limiting - Time-based message tracking per player
Auto-Mute System
- Repeat Offender Detection - Automatically mutes players who get spam-kicked repeatedly (default: 3 kicks in 10 min = 5 min mute)
- Persistent Storage - Mutes survive server restarts (database or YAML)
- Smart Timer - Pauses when player disconnects, resumes on rejoin
- Configurable Durations - Fully customizable thresholds and durations
Private Messaging
- Built-in Commands -
/msg, /w, /tell, /pm, /dm, /whisper
- Reply System -
/r and /reply to quickly respond
- Color Customization - Private messages in custom colors (default: magenta)
- Spam Protection - All anti-spam checks apply to PMs
- Mute Compatibility - Optional setting to allow muted players to receive (but not send) PMs
Chat Enhancement
- Colored Messages - Prefix messages with
> for custom color (default: light green)
- Silent Blocking - Configurable notifications when messages are blocked
- Permission Bypass - Trusted players skip all checks
- Customizable Messages - All plugin messages can be customized
Technical Excellence
- Folia Compatible - Full support for region-based threading
- High Performance - Minimal overhead (<1ms per message)
- Database Support - SQLite or MySQL for persistent storage
- Hot Reload -
/cm reload updates config without restart
- Comprehensive Logging - Debug and verbose modes for troubleshooting
? Installation
- Download the latest
ChatManagement2-1.0.0.jar
- Place in your server's
plugins folder
- Start/restart your server
- Configure
plugins/ChatManagement2/config.yml to your needs
- Run
/cm reload to apply changes
Requirements
- Minecraft Server: 1.21.x (Paper, Folia, or compatible fork)
- Java: 21 or higher
⚙️ Configuration
Basic Setup
The default configuration works well out-of-the-box, but you can customize everything:
# Core spam detection
settings:
similarity-threshold: 80 # 0-100%, higher = more strict
message-history-size: 10 # Messages to track per player
# Duplicate message blocking
duplicate-messages:
max-repeats: 2 # Allow 2 repeats before blocking
cooldown-seconds: 30 # Clear history after this time
# Rapid spam detection
anti-spam-kick:
enabled: true
message-threshold: 7 # Messages in time window = kick
time-window-seconds: 5
# Auto-mute for repeat offenders
auto-mute:
enabled: true
kick-threshold: 3 # Kicks in window = mute
kick-window-minutes: 10
mute-duration-seconds: 300
Advanced Configuration
Database Setup
For better performance with many mutes, enable database storage:
SQLite (Recommended for most servers):
database:
enabled: true
type: sqlite
MySQL (For large servers):
database:
enabled: true
type: mysql
mysql:
host: localhost
port: 3306
database: chatmanagement
username: your_username
password: your_password
Blocked Words
Configure the word filter to your needs:
blocked-words:
enabled: true
block-partial-matches: false # Prevent false positives
min-word-length: 4 # Minimum length for partial matching
word-list:
- badword1
- badword2
Custom Messages
All messages can be customized and toggled:
messages:
notify-blocked-message: false # Silent blocking
blocked-message-notification: "&cYour message was blocked."
anti-spam-kick:
notify-player: true
kick-message: "&cYou have been kicked for spamming!"
auto-mute:
notify-player: true
mute-notification: "&cYou have been muted for &e{duration} &cseconds."
mute-message: "&cYou are muted. Time remaining: &e{time} &cseconds."
Private Messaging
Customize PM appearance:
private-messaging:
enabled: true
message-color: "&d" # Magenta
sent-format: "&7[&dYou &7-> &d{receiver}&7] &r{message}"
received-format: "&7[&d{sender} &7-> &dYou&7] &r{message}"
Chat Colors
Enable colored chat feature:
chat-colors:
enabled: true
color-prefix: ">" # Type >message for colored text
prefix-color: "&a" # Light green
? Commands
Main Commands
/chatmanagement or /cm - Main plugin command
/cm reload - Reload configuration
/cm help - Show help message
/cm version - Show plugin version
Private Messaging
/msg <player> <message> - Send a private message
/w <player> <message> - Alias for /msg
/tell <player> <message> - Alias for /msg
/pm <player> <message> - Alias for /msg
/dm <player> <message> - Alias for /msg
/whisper <player> <message> - Alias for /msg
/r <message> - Reply to last message
/reply <message> - Alias for /r
? Permissions
chatmanagement.reload - Allows reloading the plugin (default: op)
chatmanagement.bypass - Bypass all chat restrictions (default: op)
? Troubleshooting
Too Many False Positives
If legitimate messages are being blocked:
-
Increase similarity threshold:
settings:
similarity-threshold: 85 # Higher = more strict, fewer false positives
-
Disable partial word matching:
blocked-words:
block-partial-matches: false
-
Increase minimum message length:
duplicate-messages:
min-message-length: 5
Messages Not Being Blocked
If spam is getting through:
-
Decrease similarity threshold:
settings:
similarity-threshold: 75 # Lower = catches more spam
-
Lower spam thresholds:
anti-spam-kick:
message-threshold: 5
-
Enable debug mode:
settings:
debug: true
Check console for detection information.
Database Issues
If database connection fails:
- Check credentials in config
- Ensure database exists (for MySQL)
- Plugin will automatically fall back to YAML storage
- Check console for error messages
? Performance
ChatManagement 2 is designed for minimal impact:
- Average overhead: <1ms per message
- Memory usage: ~2-5 MB for typical servers
- Database queries: Optimized with prepared statements
- Thread-safe: Fully compatible with Folia's threading model
? Differences from ChatProtection
ChatManagement 2 is a complete rewrite with major improvements:
- Better Accuracy - Improved spam detection with fewer false positives
- Length-Based Filtering - Prevents blocking short, legitimate messages
- Partial Match Control - Smart boundary detection for blocked words
- Database Support - Optional SQLite/MySQL for better performance
- Enhanced Mute System - Pause/resume on disconnect/reconnect
- Improved Configuration - More granular control over all features
- Better Documentation - Comprehensive comments and examples
? Changelog
v1.0.0 (Initial Release)
- Complete rewrite of ChatProtection
- Improved spam detection algorithms
- Database support (SQLite/MySQL)
- Enhanced mute system with persistence
- Better configuration options
- Comprehensive documentation
- Folia compatibility
- Fewer false positives
- Performance optimizations
评论 0
登录后参与评分
还没有评论,来抢沙发吧