PortalCord - 面向 Paper 1.21 的现代 Discord 桥接插件
PortalCord 是一款专为 Paper 1.21 服务器设计的下一代 Discord 桥接插件。与传统桥接插件只会发送大量纯文本不同,PortalCord 利用 Discord 的现代 Embed API 提供丰富且视觉美观的消息,包含玩家头像、颜色编码的状态更新以及交互式的斜杠命令。该插件基于异步操作和 Paper 的 Adventure API 构建,旨在确保零服务器延迟的同时,实现 Minecraft 服务器与 Discord 社区之间无缝的双向通信。
? 核心功能
丰富的 Discord Embeds(嵌入消息)
每位玩家的加入、离开、死亡及进度达成都会以精美的 Discord embed 形式展示,包括通过 Crafatar 获取的玩家皮肤头像、自定义颜色(加入为绿色,离开为红色)以及格式化后的时间戳。从此告别 Discord 频道中丑陋的纯文本刷屏。
现代斜杠命令
完整的 Discord 斜杠命令集成,取代过时的前缀命令(如 !help):
/list - 在格式化的 embed 中显示所有在线玩家及其延迟(ping)数值
/server - 显示实时 TPS、服务器版本、运行时间及玩家数量
/announce <message> - 从 Discord 向所有在线 Minecraft 玩家广播消息,并带有公告格式样式
/execute <command> - 从 Discord 远程执行控制台命令(受到严格限制)
实时玩家计数器
自动更新 Discord 频道名称(语音或文本)以反映当前服务器的实时人口数量。显示格式为“? Players: 12/100”,每 60 秒更新一次(可配置)。帮助 Discord 成员无需加入 Minecraft 即可一目了然地查看服务器状态。
双向聊天同步
- Minecraft → Discord:在游戏内发送的聊天消息会以玩家皮肤头像和格式化文本的形式出现在 Discord 中
- Discord → Minecraft:在链接频道中发送的消息会带有
[Discord] 前缀并以完整 MiniMessage 颜色代码支持(RGB 颜色、渐变、悬停事件)的形式出现在游戏内
高级安全性与权限控制
- 基于角色的访问控制 (RBAC):Discord 命令锁定在特定的 Role ID 之后。只有拥有指定管理员角色的用户才能使用
/announce 或 /execute
- 命令黑名单:自动过滤敏感命令(如
/login、/password、/lp user),防止其出现在 Discord 聊天中,从而避免凭据泄露
- 词汇过滤:内置脏话过滤器,可在两个方向上屏蔽指定的词语(Discord → MC 和 MC → Discord)
- 安全的控制台访问:远程控制台访问默认禁用。必须显式启用并限制给特定的受信任角色
原生支持 Paper 1.21
专为 Paper 1.21+ 构建,使用 Adventure API 进行现代聊天处理。支持 MiniMessage 格式序列化、异步事件处理以防止主线程阻塞,以及 Java 21 优化。
? 命令参考
Minecraft 命令(游戏内):
/portalcord 或 /pc - 显示插件信息、版本和帮助
/portalcord reload - 在不重启服务器的情况下重新加载配置文件
- 权限:
portalcord.reload
- 默认:仅限 OP
Discord 斜杠命令:
所有 Discord 命令要求机器人具有 applications.commands 作用域以及适当的频道权限。
-
/list - 在丰富的 embed 中显示在线玩家、他们的延迟以及总人数
- 访问权限:所有人(@everyone 均可使用)
- 冷却时间:无
-
/server - 显示服务器统计信息,包括当前 TPS(每秒刻数)、服务器版本、运行持续时间以及在线玩家数量与最大槽位的对比
-
/announce <message: string> - 向所有在线 Minecraft 玩家广播消息,带有特殊格式(彩色 [Discord] Announcement 前缀)
- 访问权限:限制为
commands.admin-roles 中列出的 Role ID
- 参数:message(必填,最多 2000 个字符)
- 确认:返回成功/失败消息到 Discord
-
/execute <command: string> - 从 Discord 以控制台身份执行任何命令
- 访问权限:限制为
console-access.allowed-roles 中列出的 Role ID
- 安全性:配置文件中默认禁用(
console-access.enabled: false)
- 日志记录:所有执行的命令均会记录并附带用户归属信息
- 警告:这是一个强大的功能——仅授予服务器所有者/高级管理员
? 权限系统详情
Minecraft 权限节点:
portalcord.admin - 访问基础 /portalcord 命令(默认:OP)
portalcord.reload - 重新加载配置的权限(默认:OP)
Discord 角色配置:
Discord 权限不基于 Minecraft 等级,而是基于 Discord Role ID。请在 plugins/PortalCord/config.yml 中进行配置:
commands:
admin-roles:
- "123456789012345678" # 管理员角色 ID
- "987654321098765432" # 版主角色 ID
console-access:
enabled: false # 必须为 true 才能使用 /execute
allowed-roles:
- "098765432109876543" # 仅限所有者角色 ID
PortalCord - Modern Discord Bridge for Paper 1.21
PortalCord is a next-generation Discord bridge plugin designed specifically for Paper 1.21 servers. Unlike traditional bridges that spam plain text walls, PortalCord utilizes Discord's modern Embed API to deliver rich, visually appealing messages with player avatars, color-coded status updates, and interactive slash commands. Built with performance in mind using async operations and Paper's Adventure API, it ensures zero server lag while maintaining seamless two-way communication between your Minecraft server and Discord community.
? Core Features
Rich Discord Embeds
Every player join, leave, death, and advancement is displayed as a beautiful Discord embed featuring the player's skin avatar (via Crafatar), custom colors (green for joins, red for leaves), and formatted timestamps. No more ugly plain text spam in your Discord channels.
Modern Slash Commands
Full Discord slash command integration replacing outdated prefix commands (!help):
/list - Displays all online players with their ping counts in a formatted embed
/server - Shows real-time TPS, server version, uptime, and player count
/announce <message> - Broadcasts messages from Discord to all online Minecraft players with announcement formatting
/execute <command> - Execute console commands remotely from Discord (highly restricted)
Live Player Counter
Automatically updates a Discord channel name (voice or text) to reflect current server population in real-time. Displays as "? Players: 12/100" and updates every 60 seconds (configurable). Helps Discord members see server status at a glance without joining Minecraft.
Two-Way Chat Synchronization
- Minecraft → Discord: Chat messages sent in-game appear in Discord with player skin avatars and formatted text
- Discord → Minecraft: Messages sent in the linked channel appear in-game with [Discord] prefix and full MiniMessage color code support (RGB colors, gradients, hover events)
Advanced Security & Permissions
- Role-Based Access Control: Discord commands are locked behind specific Role IDs. Only users with designated admin roles can use
/announce or /execute
- Command Blacklist: Automatically filters sensitive commands (/login, /password, /lp user) from appearing in Discord chat to prevent credential leaks
- Word Filtering: Built-in profanity filter that blocks specified words in both directions (Discord → MC and MC → Discord)
- Secure Console Access: Remote console access disabled by default. Must be explicitly enabled and restricted to specific trusted roles
Paper 1.21 Native
Built specifically for Paper 1.21+ using the Adventure API for modern chat handling. Supports MiniMessage format serialization, async event handling to prevent main thread blocking, and Java 21 optimizations.
? Command Reference
Minecraft Commands (In-game):
/portalcord or /pc - Displays plugin information, version, and help
/portalcord reload - Reloads configuration file without server restart
- Permission:
portalcord.reload
- Default: OP only
Discord Slash Commands:
All Discord commands require the bot to have applications.commands scope and appropriate channel permissions.
-
/list - Shows online players, their ping, and total count in a rich embed
- Access: Everyone (@everyone can use)
- Cooldown: None
-
/server - Displays server statistics including current TPS (Ticks Per Second), server version, uptime duration, and online player count vs max slots
- Access: Everyone
- Updates: Real-time data
-
/announce <message: string> - Broadcasts a message to all online Minecraft players with special formatting (colored [Discord] Announcement prefix)
- Access: Restricted to Role IDs listed in
commands.admin-roles
- Parameter: message (required, max 2000 characters)
- Confirmation: Returns success/failure message to Discord
-
/execute <command: string> - Executes any command as console from Discord
- Access: Restricted to Role IDs listed in
console-access.allowed-roles
- Security: Disabled by default in config (console-access.enabled: false)
- Logging: All executed commands logged with user attribution
- Warning: Powerful feature - only grant to server owners/senior admins
? Permission System Details
Minecraft Permission Nodes:
portalcord.admin - Access to base /portalcord command (Default: OP)
portalcord.reload - Permission to reload configuration (Default: OP)
Discord Role Configuration:
Discord permissions are not based on Minecraft ranks but on Discord Role IDs. Configure these in plugins/PortalCord/config.yml:
commands:
admin-roles:
- "123456789012345678" # Admin Role ID
- "987654321098765432" # Moderator Role ID
console-access:
enabled: false # Must be true to use /execute
allowed-roles:
- "098765432109876543" # Owner Role ID only
评论 0
登录后参与评分
还没有评论,来抢沙发吧