DiscordAuth
DiscordAuth 是一个 Velocity 插件,用于将 Minecraft 账号与 Discord 账号关联以实现身份验证。
安装
- 将
discordauth-<version>.jar 文件放入你的 Velocity plugins 文件夹中。
配置
首次运行插件时,它将生成:
plugins/discordauth/config.properties
编辑该文件并填写以下内容:
discord.token=YOUR_DISCORD_BOT_TOKEN_HERE
discord.guildId=123456789012345678
discord.roleId=987654321098765432
discord.adminId=000000000000000000
security.maxFailures=3
security.blockMinutes=5
integration.lom.allowedUsersPath=plugins/limited-offline-mode/allowed-users.txt
- 创建一个 Discord 机器人并获取其令牌(可在网上搜索相关教程)。
- 在启用开发者模式的情况下,可以从 Discord 中获取 ID。
必需的 Discord 机器人权限
Bot
- Server Members Intent
- Message Content Intent
OAuth2
- bot
- Send Messages
- Manage Roles
使用方法
- 当玩家连接到 Velocity 且尚未通过验证时,游戏中会生成一个六位数的验证码。
- 玩家通过私信向 Discord 机器人发送以下命令:
!verify <verification code>
- 如果用户拥有
config.properties 中指定的服务器和角色,他们的 Minecraft 账号将与 Discord 账号关联。
- 后续连接无需再次验证。
管理员命令
!delete <DiscordID>
- 仅可由
adminId 中指定的用户执行。
- 如果成功,将自动发生以下情况:
- 玩家与 Velocity 断开连接。
- 该角色将从 Discord 服务器中的用户处移除。
集成
此插件旨在与 Limited Offline Mode 插件集成。
启用后,列在 LOM 的 allowed-users.txt 中的玩家可以绕过 Discord 验证,即使代理处于 online-mode 状态。这对于允许特定账户(如摄像头机器人或测试账户)无需拥有 Discord 账户即可加入服务器非常有用,同时仍会对所有其他在线玩家强制执行验证。
要启用此功能,请在您的 config.properties 中设置指向 LOM 的 allowed-users.txt 的路径。如果此路径留空,则集成将被禁用。
安全性
- 此插件设计用于运行设置为
online-mode=true 的 Velocity 代理。
- 与 Limited Offline Mode 集成:为了安全地允许特定的离线账户,此插件可以与
Limited Offline Mode 集成。详情请参见“集成”部分。
- IP 封禁:为防止暴力破解攻击,验证失败次数按 IP 地址单独计算。达到可配置的失败次数后(默认:3 次),该 IP 地址将被暂时封禁(默认:5 分钟)。
数据存储
已验证的账户保存在以下位置:
plugins/discordauth/verified.json
当命令通过 DM 与机器人成功执行时,此文件会自动更新。
许可证
MIT 许可证
DiscordAuth
DiscordAuth is a Velocity plugin that links Minecraft accounts with Discord accounts for authentication.
Installation
- Place the
discordauth-<version>.jar file in your Velocity plugins folder.
Configuration
When you run the plugin for the first time, it will generate:
plugins/discordauth/config.properties
Edit the file and fill in the following:
discord.token=YOUR_DISCORD_BOT_TOKEN_HERE
discord.guildId=123456789012345678
discord.roleId=987654321098765432
discord.adminId=000000000000000000
security.maxFailures=3
security.blockMinutes=5
integration.lom.allowedUsersPath=plugins/limited-offline-mode/allowed-users.txt
- Create a Discord bot and obtain its token (search online for instructions).
- IDs can be obtained from Discord with Developer Mode enabled.
Required Discord Bot Permissions
Bot
- Server Members Intent
- Message Content Intent
OAuth2
- bot
- Send Messages
- Manage Roles
Usage
- When a player connects to Velocity and is not yet verified, a 6-digit verification code will be generated in-game.
- The player sends the following command via DM to the Discord bot:
!verify <verification code>
- If the user has the specified server and role in
config.properties, their Minecraft account will be linked with their Discord account.
- Subsequent connections do not require verification.
Admin Commands
!delete <DiscordID>
- Can only be executed by the user specified in
adminId.
- If successful, the following occurs automatically:
- The player is disconnected from Velocity.
- The role is removed from the user in the Discord server.
Integrations
This plugin is designed to integrate with the Limited Offline Mode plugin.
When enabled, players listed in LOM's allowed-users.txt can bypass Discord verification, even when the proxy is in online-mode. This is useful for allowing specific accounts (like camera bots or test accounts) to join without needing a Discord account, while still enforcing verification for all other online players.
To enable this, set the path to LOM's allowed-users.txt in your config.properties. If this path is left empty, the integration is disabled.
Security
- This plugin is designed to run on a Velocity proxy set to
online-mode=true.
- Integration with Limited Offline Mode: For securely allowing specific offline accounts, this plugin can integrate with
Limited Offline Mode. See the "Integrations" section for details.
- IP Blocking: To prevent brute-force attacks, verification failures are counted per IP. After a configurable number of failures (default: 3), the IP is temporarily blocked (default: 5 minutes).
Data Storage
Verified accounts are saved in:
plugins/discordauth/verified.json
This file is automatically updated when commands succeed via DM with the bot.
License
MIT License
评论 0
登录后参与评分
还没有评论,来抢沙发吧