DiscordAuthMeBridge
DiscordAuthMeBridge 是一款 Minecraft 服务器插件,通过安全的 HTTP 桥接连接 Minecraft、Discord 和 AuthMe。它提供账号绑定、登录验证、可信 IP 管理,以及面向 Discord 机器人和支持的服务器服务的集成端点。
本插件专为基于 Paper 的 Minecraft 服务器构建,使用 AuthMe 进行身份验证,使用 SQLite 持久化存储账号数据,并通过 HTTP API 实现 Minecraft 与外部 Discord 机器人服务之间的通信。
✨ 功能特性
? Minecraft ↔ Discord 账号绑定
- 将 Minecraft 账号与 Discord 身份进行绑定。
- 在确认绑定前,要求 Minecraft 玩家处于在线状态并通过 AuthMe 完成身份验证。
- 直接在 Minecraft 聊天界面发送交互式确认和拒绝按钮。
- 使用可配置过期时间的临时绑定请求。
- 强制实行 Minecraft 账号与 Discord 账号之间的一对一关系。
- 将账号绑定信息存储在本地 SQLite 数据库中。
? 登录安全与 IP 验证
- 检测来自未识别 IP 地址的登录尝试。
- 为各个 Minecraft 账号维护可信 IP 地址列表。
- 向已连接的 Discord 机器人发送登录验证请求。
- 允许玩家通过 Discord 批准或拒绝可疑的登录尝试。
- 可配置验证超时时间和 Minecraft 踢出消息。
- 持久化存储可信 IP 信息。
? AuthMe 集成
- 直接与 AuthMe API 集成。
- 在完成受保护的操作前检查玩家是否已通过身份验证。
- 提供 HTTP 端点,用于对照 AuthMe 验证 Minecraft 凭据。
- 验证账号注册和密码有效性,而无需在插件数据库中存储 Minecraft 密码。
? HTTP 桥接 API
- 提供 Minecraft 与外部服务之间经过身份验证的 HTTP 接口。
- 支持账号绑定请求和 IP 验证操作。
- 对 Minecraft 事件进行排队,供 Discord 机器人检索并确认接收。
- 公开用于支持的权限组(rank)查询、权限组申请以及游戏内密钥分发集成的端点。
- 使用可配置的主机、端口和共享密钥来访问 API。
?️ 持久化存储
- 使用 SQLite 存储账号绑定记录和可信 IP 记录。
- 自动初始化数据库及所需的数据表。
- 避免需要单独的数据库服务器。
?️ 安全性与可靠性
- 使用共享密钥验证传入的桥接请求。
- 拒绝未经授权的 HTTP 请求。
- 自动使临时绑定请求失效。
- 防止重复的账号关联。
- 在绑定确认过程中验证玩家身份和 AuthMe 认证状态。
- 通过 Bukkit/Paper 调度器执行 Minecraft 服务器操作。
⚙️ 配置
- 配置 HTTP 桥接主机、端口和共享密钥。
- 配置绑定码(link-code)的过期时间。
- 启用或禁用 IP 检查。
- 自定义 IP 验证消息、Discord 通知文本和超时设置。
- 配置可选的 PIN 相关设置。
? 工作原理
- 连接 Discord 机器人
在插件配置中配置 HTTP 桥接和共享密钥。外部 Discord 机器人必须使用相同的桥接凭据。
- 请求账号绑定
Discord 机器人通过 HTTP API 提交绑定请求,指定 Discord 身份和 Minecraft 用户名。
- 在 Minecraft 中确认
插件向指定的在线玩家发送交互式确认消息。玩家可以直接在 Minecraft 中批准或拒绝该请求。
- 验证并保存
当玩家确认后,插件会检查 AuthMe 认证状态,验证待处理的请求,并确保没有任何一个账号已经绑定到其他身份。
- 通知 Discord
绑定成功后,插件会将一个“绑定完成”事件加入队列,供 Discord 机器人检索并确认接收。
- 验证陌生登录地址
当启用 IP 检查时,不受信任的地址可能会触发 Discord 验证请求。玩家必须完成验证流程后才能继续进行新的登录。
? 命令
Minecraft
- "/discordauth confirm <requestId>" — 确认待处理的 Discord 账号绑定请求。
- "/discordauth reject <requestId>" — 拒绝待处理的 Discord 账号绑定请求。
注意:这些是由绑定工作流暴露的预期命令格式。在将其列为支持的命令之前,请在发布的 JAR 文件中验证命令注册情况。
HTTP API
插件公开了以下端点:
- AuthMe 凭据验证
- Discord 账号绑定请求
- IP 验证批准与拒绝
- 权限组(rank)查询与申请
- 游戏内密钥分发
- Minecraft 到 Discord 的事件轮询与确认
所有受保护的 API 请求都必须包含配置的桥接密钥(bridge secret)。
⚙️ 配置
主配置文件位于 "plugins/DiscordAuthMeBridge/config.yml"。
重要的配置部分包括:
- "Check-IP" — 启用或禁用 IP 检查。
- "Link-Code.Expires-In" — 配置绑定码的过期时间。
- "Bridge.Host" — HTTP 桥接绑定地址。
- "Bridge.Port" — HTTP 桥接监听端口。
- "Bridge.Secret" — 受保护的 API 请求所需的共享密钥。
- "IP-Verification.Timeout" — IP 验证请求的过期时间。
- "IP-Verification.Kick-Message" — 针对未识别 IP 地址的 Minecraft 踢出消息。
- "IP-Verification.Discord" — Discord 验证消息和操作标签。
- "PIN.enabled" — PIN 相关功能设置。
- "PIN.digits" — 配置的 PIN 长度。
请使用强效且私密的桥接密钥,切勿在截图、配置示例或源代码归档中发布该密钥。
? 依赖要求
- Minecraft server: 验证与发行版所针对的确切 Paper 构建版本的兼容性。
- Java: 提供的 Maven 构建配置使用 Java 25。
- AuthMe: 必需。
- Discord bot: 必需,用于基于 Discord 的验证和机器人集成。
- LuckPerms: 可选依赖项,用于支持的权限组(rank)集成。
- SQLite: 通过插件的数据库依赖项包含。
?️ 存储
该插件将其账号链接和受信任的 IP 信息存储在插件数据目录下的本地 SQLite 数据库中。
无需外部数据库服务器。
? 安装
- 安装兼容的 Paper 服务器并安装 AuthMe。
- 将 "DiscordAuthMeBridge.jar" 放入服务器的 "plugins" 文件夹中。
- 启动服务器以生成默认配置文件。
- 配置 HTTP 桥接,包括其主机、端口和共享密钥。
- 配置外部 Discord 机器人使用相同的桥接凭据。
- 重启服务器并检查控制台是否有启动错误。
- 在生产服务器部署之前,测试账号链接和 IP 验证功能。
? 支持
在报告问题时,请包含以下内容:
- Minecraft 和服务端软件版本
- DiscordAuthMeBridge 版本
- Java 版本
- 相关的控制台错误日志
- 相关配置文件(已移除所有密钥和敏感信息)
DiscordAuthMeBridge —— 通过账号链接、登录验证以及可扩展的 HTTP 桥接,连接 Minecraft、Discord 和 AuthMe。
DiscordAuthMeBridge
DiscordAuthMeBridge is a Minecraft server plugin that connects Minecraft, Discord, and AuthMe through a secure HTTP bridge. It provides account linking, login verification, trusted IP management, and integration endpoints for Discord bots and supported server services.
Built for Paper-based Minecraft servers, the plugin uses AuthMe for authentication, SQLite for persistent account data, and an HTTP API for communication between Minecraft and external Discord bot services.
✨ Features
? Minecraft ↔ Discord Account Linking
- Link Minecraft accounts with Discord identities.
- Require the Minecraft player to be online and authenticated through AuthMe before confirming a link.
- Send interactive confirmation and rejection buttons directly in Minecraft chat.
- Use temporary link requests with configurable expiration.
- Enforce a one-to-one relationship between Minecraft accounts and Discord accounts.
- Store account links in a local SQLite database.
? Login Security & IP Verification
- Detect login attempts from unrecognized IP addresses.
- Maintain trusted IP addresses for individual Minecraft accounts.
- Send login verification requests to the connected Discord bot.
- Allow players to approve or reject suspicious login attempts through Discord.
- Configure verification timeouts and Minecraft kick messages.
- Store trusted IP information persistently.
? AuthMe Integration
- Integrate directly with the AuthMe API.
- Check whether players are authenticated before completing protected operations.
- Provide an HTTP endpoint for validating Minecraft credentials against AuthMe.
- Verify account registration and password validity without storing Minecraft passwords in the plugin database.
? HTTP Bridge API
- Provide an authenticated HTTP interface between Minecraft and external services.
- Support account-linking requests and IP verification actions.
- Queue Minecraft events for the Discord bot to retrieve and acknowledge.
- Expose endpoints for supported rank lookup, rank application, and in-game key delivery integrations.
- Use a configurable host, port, and shared secret for API access.
?️ Persistent Storage
- Use SQLite for account links and trusted IP records.
- Automatically initialize the database and required tables.
- Avoid the need for a separate database server.
?️ Security & Reliability
- Validate incoming bridge requests using a shared secret.
- Reject unauthorized HTTP requests.
- Expire temporary linking requests automatically.
- Prevent duplicate account associations.
- Validate player identity and AuthMe authentication during link confirmation.
- Execute Minecraft server operations through the Bukkit/Paper scheduler.
⚙️ Configuration
- Configure the HTTP bridge host, port, and shared secret.
- Configure link-code expiration.
- Enable or disable IP checking.
- Customize IP verification messages, Discord notification text, and timeouts.
- Configure optional PIN-related settings.
? How It Works
- Connect the Discord bot
Configure the HTTP bridge and shared secret in the plugin configuration. The external Discord bot must use the same bridge credentials.
- Request an account link
The Discord bot submits a linking request through the HTTP API, specifying the Discord identity and Minecraft username.
- Confirm in Minecraft
The plugin sends an interactive confirmation message to the specified online player. The player can approve or reject the request directly in Minecraft.
- Validate and save
When the player confirms, the plugin checks AuthMe authentication, validates the pending request, and ensures neither account is already linked to a different identity.
- Notify Discord
After a successful link, the plugin queues a link-completion event for the Discord bot to retrieve and acknowledge.
- Verify unfamiliar login addresses
When IP checking is enabled, an untrusted address can trigger a Discord verification request. The player must complete the verification workflow before proceeding with a new login.
? Commands
Minecraft
- "/discordauth confirm <requestId>" — Confirm a pending Discord account-linking request.
- "/discordauth reject <requestId>" — Reject a pending Discord account-linking request.
Note: These are the intended command forms exposed by the linking workflow. Verify command registration in the released JAR before publishing them as supported commands.
HTTP API
The plugin exposes endpoints for:
- AuthMe credential verification
- Discord account-linking requests
- IP verification approval and rejection
- Rank lookup and rank application
- In-game key delivery
- Minecraft-to-Discord event polling and acknowledgement
All protected API requests must include the configured bridge secret.
⚙️ Configuration
The main configuration file is "plugins/DiscordAuthMeBridge/config.yml".
Important configuration sections include:
- "Check-IP" — Enables or disables IP checking.
- "Link-Code.Expires-In" — Configures link-code expiration.
- "Bridge.Host" — HTTP bridge bind address.
- "Bridge.Port" — HTTP bridge listening port.
- "Bridge.Secret" — Shared secret required for protected API requests.
- "IP-Verification.Timeout" — Expiration time for IP verification requests.
- "IP-Verification.Kick-Message" — Minecraft kick message for unrecognized IP addresses.
- "IP-Verification.Discord" — Discord verification message and action labels.
- "PIN.enabled" — PIN-related feature setting.
- "PIN.digits" — Configured PIN length.
Use a strong, private bridge secret and never publish it in screenshots, configuration examples, or source archives.
? Requirements
- Minecraft server: Verify compatibility with the exact Paper build targeted by the release.
- Java: 25 for the supplied Maven build configuration.
- AuthMe: Required.
- Discord bot: Required for Discord-based verification and bot integration.
- LuckPerms: Optional dependency for supported rank integrations.
- SQLite: Included through the plugin's database dependency.
?️ Storage
The plugin stores account links and trusted IP information in a local SQLite database under its plugin data directory.
No external database server is required.
? Installation
- Install a compatible Paper server and AuthMe.
- Place "DiscordAuthMeBridge.jar" in the server's "plugins" folder.
- Start the server to generate the default configuration.
- Configure the HTTP bridge, including its host, port, and shared secret.
- Configure the external Discord bot to use the same bridge credentials.
- Restart the server and check the console for startup errors.
- Test account linking and IP verification before deploying to a production server.
? Support
When reporting an issue, include:
- Minecraft and server software versions
- DiscordAuthMeBridge version
- Java version
- Relevant console errors
- Relevant configuration with all secrets and sensitive information removed
DiscordAuthMeBridge — Connecting Minecraft, Discord, and AuthMe with account linking, login verification, and an extensible HTTP bridge.
评论 0
登录后参与评分
还没有评论,来抢沙发吧