DiscordAuth 插件
由 theTWIXhunter 开发的 Minecraft 服务器(Paper 1.21+)Discord 验证认证插件。通过 DM 验证码将玩家账户与 Discord 关联,或使用新的对话框功能允许基于密码的认证。
功能
- Discord 验证:玩家输入其 Discord 用户 ID,并通过机器人私聊接收 4 位验证码进行验证
- 备用密码系统:在失去 Discord 访问权限时设置备用密码
- 仅密码模式:允许仅使用密码注册(无需 Discord)
- 多语言支持:内置多种语言支持(英语 (英国)、荷兰语 (比利时))
- 智能认证跳过:跳过正版账户或匹配 IP 的登录验证(可配置)
- 账户管理:玩家可以解除 Discord 账户绑定、登出以及管理密码
- 安全选项:
- 每个 Discord 账户最多绑定的 Minecraft 账户数限制
- 验证超时时间
- 强制 OP 或特定权限组进行认证
- 实验性功能:
- Discord 角色同步(根据 Discord 角色授予 Minecraft 权限)
- DiscordSRV 兼容模式
命令
/discordauth <reload|unlink|logout>- 主命令(别名:/dauth)reload- 重新加载插件配置(管理员)unlink [player]- 解除 Discord 账户绑定logout [player]- 退出验证会话
/password <set|change|forgot>- 管理备用密码(别名:/pw,/passwd)/logout [player]- 快速登出命令/unlink [player]- 快速解除绑定命令
权限
discordauth.use- 允许使用基本命令(默认:true)discordauth.admin- 允许使用管理员命令(默认:op)discordauth.force.login- 拥有此权限的玩家必须始终进行认证
默认配置
# +--------------------------------------------------------------------------+
# | ------====== DISCORD AUTH PLUGIN ======------ |
# | --- By TheTWIXhunter --- |
# +--------------------------------------------------------------------------+
# | | |
# | More information about this config file can be found here: |
# | https://thetwixhunter.nekoweb.org/discordauth/guides/configuration.html |
# | |
# | !!!! ---MAKE SURE TO SET THE BOT TOKEN IN bottoken.yml--- !!!! |
# | |
# | The initial setup guide can be found here: |
# | https://thetwixhunter.nekoweb.org/discordauth/guides/initial-setup.html |
# +--------------------------------------------------------------------------+
# +--------------------------------------------------------------------------+
# | ------====== GENERAL SETTINGS ======------ |
# +--------------------------------------------------------------------------+
# Server name (shown in Discord messages)
server-name: "My Minecraft Server"
# Discord server invite link (shown when DMs fail)
discord-invite: "https://discord.gg/YOUR_INVITE_CODE"
# Maximum number of Minecraft accounts allowed per Discord account (0 = unlimited)
max-accounts-per-discord: 0
# Language file to use (from the languages folder)
# Available: en-uk.yml, nl-be.yml
language: "en-uk"
# Verification timeout in seconds (0 to disable, recommended: 600 for 10 minutes)
# Players will be kicked if they don't verify within this time
verification-timeout: 600
# +--------------------------------------------------------------------------+
# | ------====== VERIFICATION METHODS ======------ |
# +--------------------------------------------------------------------------+
# | | |
# | Control how players verify their accounts (Discord, password, etc.) |
# | |
# +--------------------------------------------------------------------------+
# Allow players to login with password even when they have Discord linked
# (for when players lose Discord access)
# Players can set a password and use it to verify instead of Discord when they lost access to their account
enable-backup-password: true
# Kick players after X failed login attempts (default 3, 0 to disable)
# This helps prevent brute-force attacks on accounts
max-login-attempts: 3
# +--------------------------------------------------------------------------+
# | ------====== AUTHENTICATION SETTINGS ======------ |
# +--------------------------------------------------------------------------+
# | Each group below can be set to one of these modes: |
# | - disabled -> do not check this group |
# | - force -> always require authentication |
# | - skip-login -> skip login, but still require an account to exist |
# | - no-register -> skip login and registration completely |
# +--------------------------------------------------------------------------+
authentication-skip:
# ----- DEFAULTS -----
# Top-level fallback used whenever a player doesn't match any group.
default-mode: "force"
# Top-level fallback for password access when a player doesn't match any group.
# Values: discord, password, both, disabled
password-feature-default: "both"
# ----- GROUPS -----
# Operators can be forced, skipped, or disabled
operators: "force"
operators-password-feature: "disabled"
# Players whose current IP matches the IP stored on their account
known-ip: "skip-login"
known-ip-password-feature: "disabled"
# 具有玩家专属模式的特定玩家
# 使用 name、player 或 username 作为每个条目的键
specific-players:
- name: "DebugPlayer1"
mode: "disabled"
password-feature: "disabled"
- name: "TestAccount"
mode: "disabled"
password-feature: "disabled"
# 通过 Floodgate 或 Geyser 检测到的基岩版玩家(如果可用)
bedrock-players: "disabled"
bedrock-players-password-feature: "disabled"
# 正版 Java 版玩家。在离线模式服务器中,仅当服务器或代理仍为会话暴露正版 UUID 时才有效。
premium-users: "disabled"
premium-users-password-feature: "disabled"
初始设置
-
创建 Discord 机器人
- 前往 Discord Developer Portal
- 创建一个新的应用程序
- 添加一个机器人并复制机器人令牌 (Bot Token)
- 启用以下特权网关意图 (Privileged Gateway Intents):
- 服务器成员意图 (Server Members Intent)
- 消息内容意图 (Message Content Intent)
-
配置插件
- 编辑
plugins/DiscordAuth/bot-token.yml - 将
PUT_YOUR_BOT_TOKEN_HERE替换为你的机器人令牌 - 根据你的偏好编辑
plugins/DiscordAuth/config.yml - 设置你的
server-name和discord-invite链接
- 编辑
-
邀请机器人
- 使用机器人的 OAuth2 URL 并包含以下作用域:
bot - 所需权限:发送消息、读取消息、嵌入链接
- 使用机器人的 OAuth2 URL 并包含以下作用域:
有关详细的设置说明,请访问:(该网站仍在完善中)
构建
运行 mvn clean package 以构建插件。编译后的 JAR 文件将位于 target 文件夹中。
安装
- 构建插件或下载 JAR 文件
- 将 JAR 文件放入服务器的
plugins文件夹 - 重启服务器
- 遵循上述“初始设置”指南
- 配置
plugins/DiscordAuth/bot-token.yml和config.yml - 重新加载或重启服务器
工作原理
首次注册
- 玩家加入服务器
- 插件通过对话框提示输入 Discord 用户 ID 或设置密码
- 如果使用 Discord:机器人通过私信发送 4 位验证码 → 玩家输入验证码
- 如果仅使用密码:玩家设置密码
- 账户注册完成,玩家可以加入
返回玩家
- 玩家加入服务器
- 如果满足跳过规则(正版身份/IP 匹配),玩家立即加入
- 否则,玩家必须通过 Discord 验证码或密码进行验证
- 验证通过后,玩家可以加入
作者
me.theTWIXhunter
你是这个资源的作者?登录后可认领此资源。
相似资源
PacketEvents 是一款专为 Minecraft Java 版打造的协议库,旨在简化数据包的处理与传输。
ExyliaPlugins 的库。
通过对话框或铁砧界面帮助你的 Anthme
自定义你的Minecraft头像!
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
为基于 Spigot/Paper/Folia 的服务器添加对 Vivecraft 的支持
评论 0
登录后参与评分
还没有评论,来抢沙发吧