ArkShield-AI
基于 AI 大语言模型的 Minecraft 聊天违禁词检测插件
简介
ArkShield-AI 是一款适用于 Purpur 1.21.1 服务器的聊天内容审核插件。通过集成 AI 大语言模型(默认为 DeepSeek),对玩家聊天消息进行智能违禁词检测,支持三级检测、自动禁言以及管理员手动禁言功能。
特性
- AI 检测 — 使用大语言模型分析聊天内容,比传统的关键词匹配更准确
- 检测等级 — 简单 / 普通 / 严格,可通过配置文件或命令配置
- 异步处理 — AI 请求异步处理,不影响服务器 TPS
- 自动禁言 — 达到违规阈值后自动禁言玩家,可配置持续时间和阈值
- 管理员禁言/解禁 — 基于命令的控制,便于灵活管理
- 缓存机制 — 相同消息不会触发重复的 AI 请求,减少 API 调用
- 日志记录 — 被拦截的消息可输出到控制台和日志文件
- 管理员通知 — 实时向在线管理员发送被拦截消息的通知
- 权限系统 — 支持绕过权限以跳过检测
要求
| 项目 |
要求 |
| 服务器 |
Purpur 1.21.1 |
| Java |
JDK 21 |
| 构建工具 |
Maven |
快速开始
1. 构建
mvn clean package
构建产物位于 target/ArkShield-AI-1.0.0.jar。
2. 部署
将 ArkShield-AI-1.0.0.jar 复制到服务器的 plugins/ 目录并重启服务器。
3. 配置 API Key
首次运行后,会自动生成 plugins/ArkShield-AI/config.yml。编辑 ai.api-key 字段:
ai:
base-url: "https://api.deepseek.com/v1"
api-key: "sk-your-api-key-here" # 替换为你的实际 API Key
model: "deepseek-chat"
支持任何 OpenAI 兼容接口——只需修改 base-url 和 api-key 即可。
4. 重启服务器
配置完成后,重启服务器以使插件生效。
命令
| 命令 |
描述 |
权限 |
/arkshield reload |
重新加载配置文件 |
arkshield.admin |
/arkshield status |
查看插件运行状态 |
arkshield.admin |
/arkshield level <1|2|3> |
设置检测等级 |
arkshield.admin |
/arkshield mute <player> [duration] |
手动禁言玩家(持续时间为分钟) |
arkshield.admin |
/arkshield unmute <player> |
手动解禁言玩家 |
arkshield.admin |
权限节点
| 权限 |
描述 |
默认值 |
arkshield.admin |
允许使用管理员命令 |
OP |
arkshield.bypass |
绕过 AI 聊天检测 |
false |
检测等级
| 等级 |
名称 |
检测范围 |
| 1 |
简单 |
暴力威胁、色情内容、严重人身攻击 |
| 2 |
普通 |
+ 种族歧视、恶意刷屏 (默认) |
| 3 |
严格 |
+ 广告、政治敏感、负面诱导、侮辱性语言 |
配置文件
配置文件路径:plugins/ArkShield-AI/config.yml
# AI 接口配置
ai:
base-url: "https://api.deepseek.com/v1" # API 端点
api-key: "sk-your-api-key-here" # API 密钥
model: "deepseek-chat" # 模型名称
enable-thinking: false # 思考模式(仅适用于推理模型)
timeout: 15 # 请求超时时间(秒)
# 检测等级 (1/2/3)
level: 2
# 禁言配置
mute:
enabled: true # 启用自动禁言
violation-threshold: 3 # 触发禁言所需的违规次数
duration-minutes: 10 # 禁言持续时间(分钟)
violation-reset-minutes: 60 # 违规计数重置时间(分钟)
# 消息配置(支持 & 颜色代码)
messages:
blocked: "&c[ArkShield] &f你的消息包含不当内容,已被拦截。"
admin-alert: "&e[ArkShield] &f玩家 &c%player% &f发送了一条被拦截的消息:&7%message%"
# 管理员通知
admin-notify:
enabled: true
permission: "arkshield.admin"
# 日志配置
logging:
log-to-console: true
log-to-file: true
log-file: "blocked_messages.log"
# 缓存配置
cache:
enabled: true
expire-minutes: 30
max-size: 1000
工作流程
玩家发送消息
│
├── 拥有绕过权限? ──→ 直接放行
│
├── 处于禁言状态? ──→ 拦截并显示剩余时间提示
│
├── 发送者立即看到自己的消息
│
├── 异步发送 AI 检测请求
│ │
│ ├── AI 返回正常 ──→ 向其他玩家广播消息
│ │
│ └── AI 返回违规 ──→ 拦截消息
│ ├── 通知玩家
│ ├── 通知管理员
│ ├── 记录到文件
│ ├── 记录违规次数
│ └── 达到阈值? ──→ 自动禁言玩家
│
└── AI 请求失败 ──→ 默认放行(不影响聊天)
文件结构
ArkShield-AI/
├── pom.xml
├── README.md
└── src/main/
├── java/com/arkshield/ai/
│ ├── ArkShieldAI.java # 插件主类
│ ├── command/
│ │ └── ArkShieldCommand.java # 管理员命令
│ ├── config/
│ │ └── ConfigManager.java # 配置管理
│ ├── listener/
│ │ └── ChatListener.java # 聊天事件监听器
│ └── service/
│ ├── AIService.java # AI 接口服务
│ ├── HeartbeatService.java # 心跳上报服务(用于统计使用情况)
│ └── MuteService.java # 禁言管理服务
└── resources/
├── config.yml # 默认配置
└── plugin.yml # 插件描述
许可证
本项目在 MIT 许可证 下开源。
使用本插件即表示您同意我们的 隐私政策 和 服务条款。
使用本项目即表示您同意我们的插件将向我们的服务器发送心跳包,以统计用户数量。
版权所有 © 2026 DreamArk Network Technology Studio
ArkShield-AI
Minecraft Chat Profanity Detection Plugin Based on AI Large Language Model
Introduction
ArkShield-AI is a chat content moderation plugin for Minecraft Purpur 1.21.1 servers. By integrating with AI large language models (default DeepSeek), it performs intelligent profanity detection on player chat messages, supporting three detection levels, automatic muting, and manual admin muting.
Features
- AI Detection — Analyzes chat content using large language models, more accurate than traditional keyword matching
- Detection Levels — Simple / Normal / Strict, configurable via config file or commands
- Asynchronous Processing — AI requests are processed asynchronously, no impact on server TPS
- Auto Mute — Automatically mutes players after reaching violation threshold, configurable duration and threshold
- Admin Mute/Unmute — Command-based control for flexible management
- Caching — Same messages won't trigger duplicate AI requests, reducing API calls
- Logging — Blocked messages can be output to console and log files
- Admin Notification — Blocked messages are notified to online admins in real-time
- Permission System — Supports bypass permission to skip detection
Requirements
| Item |
Requirement |
| Server |
Purpur 1.21.1 |
| Java |
JDK 21 |
| Build Tool |
Maven |
Quick Start
1. Build
mvn clean package
The built artifact is located at target/ArkShield-AI-1.0.0.jar.
2. Deploy
Copy ArkShield-AI-1.0.0.jar to the server's plugins/ directory and restart the server.
3. Configure API Key
After the first run, plugins/ArkShield-AI/config.yml will be automatically generated. Edit the ai.api-key field:
ai:
base-url: "https://api.deepseek.com/v1"
api-key: "sk-your-api-key-here" # Replace with your actual API Key
model: "deepseek-chat"
Any OpenAI-compatible interface is supported—just modify base-url and api-key.
4. Restart Server
After configuration, restart the server for the plugin to take effect.
Commands
| Command |
Description |
Permission |
/arkshield reload |
Reload configuration file |
arkshield.admin |
/arkshield status |
View plugin runtime status |
arkshield.admin |
/arkshield level <1|2|3> |
Set detection level |
arkshield.admin |
/arkshield mute <player> [duration] |
Manually mute a player (duration in minutes) |
arkshield.admin |
/arkshield unmute <player> |
Manually unmute a player |
arkshield.admin |
Permission Nodes
| Permission |
Description |
Default |
arkshield.admin |
Allows use of admin commands |
OP |
arkshield.bypass |
Bypass AI chat detection |
false |
Detection Levels
| Level |
Name |
Detection Scope |
| 1 |
Simple |
Violence threats, explicit content, severe personal attacks |
| 2 |
Normal |
+ Racial discrimination, malicious spam (Default) |
| 3 |
Strict |
+ Advertising, political sensitivity, negative诱导, offensive language |
Configuration File
Configuration file path: plugins/ArkShield-AI/config.yml
# AI Interface Configuration
ai:
base-url: "https://api.deepseek.com/v1" # API endpoint
api-key: "sk-your-api-key-here" # API key
model: "deepseek-chat" # Model name
enable-thinking: false # Thinking mode (only for reasoner)
timeout: 15 # Request timeout (seconds)
# Detection level (1/2/3)
level: 2
# Mute Configuration
mute:
enabled: true # Enable automatic muting
violation-threshold: 3 # Violations needed to trigger mute
duration-minutes: 10 # Mute duration (minutes)
violation-reset-minutes: 60 # Violation count reset time (minutes)
# Message Configuration (supports & color codes)
messages:
blocked: "&c[ArkShield] &fYour message contains inappropriate content and has been blocked."
admin-alert: "&e[ArkShield] &fPlayer &c%player% &fsent a blocked message: &7%message%"
# Admin Notification
admin-notify:
enabled: true
permission: "arkshield.admin"
# Logging Configuration
logging:
log-to-console: true
log-to-file: true
log-file: "blocked_messages.log"
# Cache Configuration
cache:
enabled: true
expire-minutes: 30
max-size: 1000
Workflow
Player sends message
│
├── Has bypass permission? ──→ Directly allowed
│
├── Is muted? ──→ Blocked with remaining time提示
│
├── Sender immediately sees their own message
│
├── Send AI detection request asynchronously
│ │
│ ├── AI returns normal ──→ Broadcast message to other players
│ │
│ └── AI returns violation ──→ Block message
│ ├── Notify player
│ ├── Notify admins
│ ├── Log to file
│ ├── Record violation count
│ └── Threshold reached? ──→ Auto-mute player
│
└── AI request fails ──→ Allow by default (no chat impact)
File Structure
ArkShield-AI/
├── pom.xml
├── README.md
└── src/main/
├── java/com/arkshield/ai/
│ ├── ArkShieldAI.java # Plugin main class
│ ├── command/
│ │ └── ArkShieldCommand.java # Admin commands
│ ├── config/
│ │ └── ConfigManager.java # Configuration management
│ ├── listener/
│ │ └── ChatListener.java # Chat event listener
│ └── service/
│ ├── AIService.java # AI interface service
│ ├── HeartbeatService.java # Heartbeat reporting service (for usage statistics)
│ └── MuteService.java # Mute management service
└── resources/
├── config.yml # Default configuration
└── plugin.yml # Plugin description
License
This project is open-sourced under the MIT License.
By using this plugin, you agree to our Privacy Policy and Terms of Service.
By using this project, you agree that our plugin will send a heartbeat packet to our server to track the number of users.
Copyright © 2026 DreamArk Network Technology Studio
评论 0
登录后参与评分
还没有评论,来抢沙发吧