Anti-Politically-Related-Content 插件
项目概述
这是一个 Minecraft Bukkit 插件,旨在检测和过滤游戏内的政治相关内容。该插件利用 OpenRouter AI API 对玩家聊天内容、命令以及玩家 ID 进行实时审核。
功能特性
- 实时监控玩家聊天内容
- 检测玩家命令中的政治内容
- 在新玩家加入时检查玩家 ID
- 自动处理违规行为:
- 发送政治内容的玩家将被踢出服务器
- 使用不当 ID 的玩家将被封禁
- 异步 API 调用,避免影响服务器性能
- 【2.0 版本更新】管理员可以通过命令启用/禁用插件
- 【4.0-RELEASE 版本更新】通过
/aprc test 测试 API 地址连接
- 【4.0-RELEASE 版本更新】API 相关配置可通过配置文件更改(意味着作者可以上传预打包的 jar 文件)
- 【4.0-RELEASE 版本更新】
/aprc reload 可重新加载配置文件
- 【4.0-RELEASE 版本更新】添加了备用 API 地址槽位,以防止某个 API 平台突然宕机
安装要求
- Minecraft Paper Server 1.21.4+
- Java 17 或更高版本
- 有效的 OpenRouter API 密钥(访问 openrouter.ai 创建)
- (可选)有效的 SiliconFlow API 密钥(访问 SiliconFlow 官网 创建)
- (可选)其他开放 API 平台的 API 密钥(需要一定的编程知识来更改模型名称和 API 地址)
安装指南
-
使用 Maven 构建项目:
mvn clean package
-
将生成的 target/anti-politically-related-content-1.0-SNAPSHOT.jar 复制到服务器的 plugins 文件夹中
-
重启服务器
配置
API 设置(修改服务器启动后生成的配置文件)
primary:
api_key: Primary_API_Key
model: deepseek/deepseek-chat-v3-0324:free
api_url: https://openrouter.ai/api/v1/chat/completions
backup:
api_key: Backup_API_Key
model: deepseek-ai/DeepSeek-R1-0528-Qwen3-8B
api_url: https://api.siliconflow.cn/v1/chat/completions
响应自定义
在 Main.java 中修改以下方法以更改违规处理方式:
handleChatViolation() - 处理聊天违规
handleNameViolation() - 处理名称违规
使用示例
- 安装并配置插件
- 插件将自动执行以下操作:
- 扫描所有聊天消息
- 检查新玩家的名字
- 检测到违规时自动采取行动
- 拥有
aprc.admin 权限的玩家可以使用 /aprc <test|on|off|reload> 命令来测试 API 地址/启用插件/禁用插件/重载插件。
注意事项
- 需要互联网连接才能访问 API
- API 调用可能会有 1-3 秒的延迟
- 免费版本有速率限制(建议高流量服务器升级)
- 在生产服务器上部署前请充分测试(作者也不确定潜在的错误数量)
开发者信息
- 项目名称:Anti-Politically-Related-Content
- 版本:4.0-RELEASE
- 依赖项:
- PaperAPI
- OkHttp 4.12.0
- Gson 2.10.1
许可证
MIT License
Anti-Politically-Related-Content Plugin
Project Overview
This is a Minecraft Bukkit plugin designed to detect and filter politically related content within the game. The plugin utilizes the OpenRouter AI API to perform real-time moderation of player chat content, commands, and player IDs.
Features
- Real-time monitoring of player chat content
- Detection of political content in player commands
- Checking player IDs upon new player joins
- Automatic handling of violations:
- Players sending political content are kicked
- Players using inappropriate IDs are banned
- Asynchronous API calls to avoid impacting server performance
- 【Version 2.0 Update】Admins can enable/disable the plugin via command
- 【Version 4.0-RELEASE Update】Test API address connection via
/aprc test
- 【Version 4.0-RELEASE Update】API-related configurations can be changed via the config file (meaning the author can upload a pre-packaged jar)
- 【Version 4.0-RELEASE Update】
/aprc reload can reload the configuration file
- 【Version 4.0-RELEASE Update】Added a backup API address slot to prevent sudden downtime of one API platform
Installation Requirements
- Minecraft Paper Server 1.21.4+
- Java 17 or higher
- A valid OpenRouter API key (visit openrouter.ai to create one)
- (Optional) A valid SiliconFlow API key (visit SiliconFlow Official Website to create one)
- (Optional) API keys from other open API platforms (requires some programming knowledge to change the model name and API address)
Installation Guide
-
Build the project using Maven:
mvn clean package
-
Copy the generated target/anti-politically-related-content-1.0-SNAPSHOT.jar to the server's plugins folder
-
Restart the server
Configuration
API Settings (Modify the config file generated after server startup)
primary:
api_key: Primary_API_Key
model: deepseek/deepseek-chat-v3-0324:free
api_url: https://openrouter.ai/api/v1/chat/completions
backup:
api_key: Backup_API_Key
model: deepseek-ai/DeepSeek-R1-0528-Qwen3-8B
api_url: https://api.siliconflow.cn/v1/chat/completions
Response Customization
Modify the following methods in Main.java to change violation handling:
- handleChatViolation() - Handles chat violations
- handleNameViolation() - Handles name violations
Usage Example
- Install and configure the plugin
- The plugin will automatically:
- Scan all chat messages
- Check new player names
- Take automatic action upon detecting violations
- Players with the aprc.admin permission can use the /aprc <test|on|off|reload> command to test the API address/enable the plugin/disable the plugin/reload the plugin.
Notes
- An internet connection is required to access the API
- API calls may have a 1-3 second delay
- The free version has rate limits (upgrading is recommended for high-traffic servers)
- Please test thoroughly before deploying on a production server (the author is also unsure about the number of potential bugs)
Developer Information
- Project Name: Anti-Politically-Related-Content
- Version: 4.0-RELEASE
- Dependencies:
- PaperAPI
- OkHttp 4.12.0
- Gson 2.10.1
License
MIT License
评论 0
登录后参与评分
还没有评论,来抢沙发吧