日文说明见下方。插件本身仅支持日语。
Japanese description is available below. The plugin itself is available in Japanese only.
wsnAuth
wsnAuth 是一个 Velocity 插件,用于将 Minecraft 账号与 Discord 账号关联,并仅允许经过验证的玩家加入你的网络。
当未验证的玩家连接时,他们会在 Minecraft 断开连接屏幕上收到一个六位数的验证码。他们可以通过在 Discord 中按下验证按钮并在显示的表单中输入代码来关联他们的账号。
功能特性
- 使用六位一次性代码进行 Minecraft 和 Discord 账号验证
- 每次登录验证时检查 Discord 服务器成员资格
- 自动分配和移除已验证的 Discord 角色
- Discord 角色与 LuckPerms 组同步
- 为 Velocity 中注册的所有后端服务器提供实时的 Discord 服务器状态面板
- PremiumVanish 支持:从状态面板中隐藏消失(vanished)玩家
- 可配置单个 Discord 账号关联的 Minecraft 账号数量上限
- 防止重复提交无效代码的保护机制
- 通过
messages.yml 自定义 Minecraft 和 Discord 消息
- 持久化存储在 JSON 中的账号关联信息
要求
- Java 17 或更高版本
- Velocity 3.4.x
- 一个 Discord Bot
- LuckPerms 5.4 或更高版本 — 可选,仅在需要角色同步时使用
- PremiumVanish — 可选,仅用于从状态面板中隐藏消失的玩家
Velocity 必须设置 online-mode=true。离线 UUID 配置无法安全地保留账号所有权。
安装步骤
- 下载插件 JAR 文件。
- 将其放入 Velocity 的
plugins 目录中。
- 启动一次 Velocity 以生成配置文件。
- 停止 Velocity 并编辑
plugins/wsnauth/config.yml。
- 再次启动 Velocity。
由于默认 Bot Token 尚未配置,插件在首次启动时将无法连接到 Discord。这是预期行为;请在再次启动 Velocity 之前编辑生成的配置文件。
Discord Bot 设置
在 Discord Developer Portal 创建一个 Bot,然后执行以下操作:
- 在 Bot 设置中启用 Server Members Intent(服务器成员意图)。
- 将 Bot 邀请到用于验证的 Discord 服务器。
- 授予 Bot 以下权限:
- View Channels(查看频道)
- Send Messages(发送消息)
- Read Message History(读取消息历史)
- Embed Links — 用于服务器状态面板
- Manage Roles — 用于已验证角色功能
- 如果使用自动角色分配,请将 Bot 的角色放在它需要管理的角色之上。
配置示例
discord:
token: "YOUR_BOT_TOKEN_HERE"
guildId: 123456789012345678
adminId: 0
verificationChannelId: 123456789012345678
verifiedRoleId: 123456789012345678
serverStatusChannelId: 123456789012345678
inviteUrl: "https://discord.gg/your-invite"
security:
maxFailures: 3
blockMinutes: 5
maxAccountsPerUser: 1
debug: false
role-sync:
- roleId: 111111111111111111
group: "member"
- roleId: 222222222222222222
group: "vip"
将可选的 Discord 功能 ID 设置为 0 以禁用该功能。如果不需要 LuckPerms 角色同步,请使用 role-sync: []。
状态频道也可以通过 SERVER_STATUS_CHANNEL_ID 环境变量进行配置。环境变量的优先级高于 config.yml。
验证流程
- 连接到 Minecraft 服务器。
- 复制断开连接屏幕上显示的六位数字代码。
- 加入配置的 Discord 服务器。
- 在验证频道中按下 認証を開始(开始验证)。
- 在显示的表单中输入代码。
- 验证成功后重新连接到 Minecraft 服务器。
验证码在五分钟后过期,且只能提交一次。如果之前的代码过期或被使用,请重新连接 Minecraft 服务器以获取新代码。
命令
| 命令 |
权限 |
描述 |
/unlink |
无 |
解除你的 Minecraft 账号与 Discord 的关联 |
/discord <player> |
discordauth.admin |
显示玩家的关联 Discord 用户名、ID 和验证日期 |
LuckPerms 同步
role-sync 下的每个条目都将一个 Discord 角色映射到一个 LuckPerms 组。同步在以下情况运行:
- 添加或删除了映射的 Discord 角色
- 已验证玩家连接到 Minecraft
- 完成 Minecraft 和 Discord 验证
只要 Discord 成员至少拥有一个映射到该组的角色,就会授予对应的 LuckPerms 组;如果没有,则移除该组。即使未安装 LuckPerms,账号验证仍会正常工作;只是禁用了角色同步功能。
服务器状态面板
当配置了 serverStatusChannelId 时,wsnAuth 会发布一个包含以下内容的 Discord Embed:
- Velocity 中注册的每个后端服务器的在线或离线状态
- 可见的玩家名称和玩家数量
- 当前可用的后端服务器数量
- Velocity 代理关闭时的离线状态
状态每五秒检查一次,并且仅在其内容发生变化时才更新 Discord 消息。安装了 PremiumVanish 时,消失的玩家将被排除在外。
安全性与数据
- 已验证的账号链接存储在
plugins/wsnauth/verified.json 中。
- 验证码仅保存在内存中,并在 Velocity 重启时清除。
- 代码包含六位数字,五分钟后过期,且只能使用一次。
- 无效的提交针对每个 Discord 账号进行速率限制。
- 离开配置 Discord 服务器的已验证玩家,直到重新加入前无法连接。
- 切勿公开你的 Bot Token 或
verified.json。
日本語
wsnAuth は、Minecraft アカウントと Discord アカウントを連携し、認証済みプレイヤーのみが参加できるようにする Velocity 用プラグインです。
未認証のプレイヤーが接続すると、Minecraft の切断画面に6桁の認証コードが表示されます。Discord の認証チャンネルでボタンを押し、表示されたフォームにコードを入力するだけで連携できます。
主な機能
- 使用6位一次性代码进行 Minecraft / Discord 账户认证
- 在已认证玩家连接时检查其在 Discord 服务器中的在线状态
- 自动授予/移除已认证的 Discord 角色
- 同步 Discord 角色与 LuckPerms 用户组
- 显示 Velocity 网络下服务器的 Discord 实时状态
- 与 PremiumVanish 集成,从状态中排除处于隐身(Vanish)状态的玩家
- 限制每个 Discord 账户可关联的 Minecraft 账户数量
- 对连续输入无效认证码的行为进行临时封禁
- 通过
messages.yml 自定义 Minecraft / Discord 消息
- 使用 JSON 存储已认证账户
必要环境
- Java 17 及以上版本
- Velocity 3.4.x
- Discord Bot
- LuckPerms 5.4 及以上 — 仅在使用角色同步功能时需要
- PremiumVanish — 仅在需要在状态中隐藏隐身玩家时需要
请将 Velocity 的 online-mode 设置为 true。在使用离线 UUID 的配置中,无法安全地识别账户所有者。
安装方法
- 下载插件 JAR 文件。
- 将其放入 Velocity 的
plugins 目录中。
- 启动一次 Velocity 以生成配置文件。
- 停止 Velocity 并编辑
plugins/wsnauth/config.yml。
- 重新启动 Velocity。
首次启动时,由于 Bot Token 为默认值,会显示连接到 Discord 的错误信息。这是正常现象。请在生成的配置文件中设置正确的 Token,然后重启。
准备 Discord Bot
请在 Discord Developer Portal 创建 Bot 并进行以下设置:
-
启用 Bot 设置中的 Server Members Intent(服务器成员意图)。
-
将 Bot 邀请至用于认证的 Discord 服务器。
-
赋予 Bot 以下权限:
- 查看频道
- 发送消息
- 读取消息历史
- 嵌入链接 — 如果使用服务器状态功能
- 管理角色 — 如果使用已认证角色功能
-
如果启用了角色的自动授予,请将 Bot 的角色置于目标授予角色的上方。
配置示例
discord:
token: "YOUR_BOT_TOKEN_HERE"
guildId: 123456789012345678
adminId: 0
verificationChannelId: 123456789012345678
verifiedRoleId: 123456789012345678
serverStatusChannelId: 123456789012345678
inviteUrl: "https://discord.gg/your-invite"
security:
maxFailures: 3
blockMinutes: 5
maxAccountsPerUser: 1
debug: false
role-sync:
- roleId: 111111111111111111
group: "member"
- roleId: 222222222222222222
group: "vip"
将可选功能的 Discord ID 设置为 0 即可禁用该功能。如果不需要 LuckPerms 角色同步,请设置为 role-sync: []。
状态频道也可以通过环境变量 SERVER_STATUS_CHANNEL_ID 指定。如果设置了环境变量,其优先级高于 config.yml。
认证流程
- 连接到 Minecraft 服务器。
- 查看断开连接画面显示的6位代码。
- 加入已配置的 Discord 服务器。
- 点击认证频道中的 开始认证 按钮。
- 在显示的表单中输入代码。
- 认证完成后,重新连接到 Minecraft 服务器。
认证代码有效期为5分钟,且仅限使用一次。如果过期或已被使用,请重新连接 Minecraft 服务器以获取新代码。
命令
| 命令 |
权限 |
说明 |
/unlink |
无 |
解除自己的 Minecraft / Discord 关联 |
/discord <player> |
discordauth.admin |
显示指定玩家的 Discord 用户名、ID 和认证时间 |
LuckPerms 角色同步
可以在 role-sync 的每一项中将 Discord 角色与 LuckPerms 用户组对应起来。同步将在以下时机执行:
- 当添加或删除 Discord 角色时
- 当已认证玩家连接到 Minecraft 时
- 当完成 Minecraft / Discord 认证时
只要拥有至少一个对应的 LuckPerms 用户组的 Discord 角色,就会授予该组;如果失去所有对应角色,则移除该组。即使未安装 LuckPerms,账户认证功能仍然可用,仅角色同步功能会被禁用。
服务器状态
设置 serverStatusChannelId 后,将在单个 Discord Embed 中显示以下信息:
- 注册到 Velocity 的各个后端服务器的在线/离线状态
- 当前显示的玩家名称和人数
- 正在运行的后端服务器数量
- Velocity 停止时的离线状态
每5秒检查一次状态,仅当内容发生变化时才更新 Discord 消息。如果安装了 PremiumVanish,将从状态中排除处于隐身状态的玩家。
安全与数据
- 已认证账户保存在
plugins/wsnauth/verified.json 中。
- 认证代码仅保存在内存中,Velocity 重启时会被清除。
- 代码为6位数字,有效期5分钟,仅限使用一次。
- 无效代码的输入按 Discord 账户进行限制。
- 如果已认证用户离开目标 Discord 服务器,在重新加入之前将无法连接。
- 请勿公开 Bot Token 或
verified.json。
许可证
wsnAuth 根据 MIT 许可证发布。
日本語は下に。プラグインは日本語のみ。
Japanese description is available below. The plugin itself is available in Japanese only.
wsnAuth
wsnAuth is a Velocity plugin that links Minecraft accounts with Discord accounts and allows only verified players to join your network.
When an unverified player connects, they receive a six-digit verification code on the Minecraft disconnect screen. They can link their account by pressing the verification button in Discord and entering the code in the displayed form.
Features
- Minecraft and Discord account verification using a six-digit one-time code
- Discord server membership checks on every verified login
- Automatic assignment and removal of a verified Discord role
- Discord role synchronization with LuckPerms groups
- Live Discord server-status panel for all backend servers registered in Velocity
- PremiumVanish support for hiding vanished players from the status panel
- Configurable limit on the number of Minecraft accounts linked to one Discord account
- Protection against repeated invalid-code submissions
- Customizable Minecraft and Discord messages through
messages.yml
- Persistent account links stored in JSON
Requirements
- Java 17 or newer
- Velocity 3.4.x
- A Discord Bot
- LuckPerms 5.4 or newer — optional, required only for role synchronization
- PremiumVanish — optional, used only to hide vanished players from the status panel
Velocity must use online-mode=true. Offline UUID configurations cannot securely preserve account ownership.
Installation
- Download the plugin JAR.
- Place it in the Velocity
plugins directory.
- Start Velocity once to generate the configuration files.
- Stop Velocity and edit
plugins/wsnauth/config.yml.
- Start Velocity again.
The plugin will fail to connect to Discord on the first startup while the default Bot Token is still configured. This is expected; edit the generated configuration before starting Velocity again.
Discord Bot setup
Create a Bot in the Discord Developer Portal, then:
- Enable Server Members Intent in the Bot settings.
- Invite the Bot to the Discord server used for verification.
- Grant the Bot the following permissions:
- View Channels
- Send Messages
- Read Message History
- Embed Links — required for the server-status panel
- Manage Roles — required for the verified-role feature
- When using automatic role assignment, place the Bot's role above the role it needs to manage.
Configuration example
discord:
token: "YOUR_BOT_TOKEN_HERE"
guildId: 123456789012345678
adminId: 0
verificationChannelId: 123456789012345678
verifiedRoleId: 123456789012345678
serverStatusChannelId: 123456789012345678
inviteUrl: "https://discord.gg/your-invite"
security:
maxFailures: 3
blockMinutes: 5
maxAccountsPerUser: 1
debug: false
role-sync:
- roleId: 111111111111111111
group: "member"
- roleId: 222222222222222222
group: "vip"
Set an optional Discord feature ID to 0 to disable that feature. If LuckPerms role synchronization is not needed, use role-sync: [].
The status channel can also be configured with the SERVER_STATUS_CHANNEL_ID environment variable. The environment variable takes priority over config.yml.
Verification flow
- Connect to the Minecraft server.
- Copy the six-digit code displayed on the disconnect screen.
- Join the configured Discord server.
- Press 認証を開始 in the verification channel.
- Enter the code in the displayed form.
- Reconnect to the Minecraft server after verification succeeds.
Verification codes expire after five minutes and can only be submitted once. Reconnect to the Minecraft server to receive a new code if the previous code expires or is consumed.
Commands
| Command |
Permission |
Description |
/unlink |
None |
Unlinks your Minecraft account from Discord |
/discord <player> |
discordauth.admin |
Displays the player's linked Discord username, ID, and verification date |
LuckPerms synchronization
Each entry under role-sync maps a Discord role to a LuckPerms group. Synchronization runs when:
- A mapped Discord role is added or removed
- A verified player connects to Minecraft
- Minecraft and Discord verification is completed
The LuckPerms group is granted while the Discord member has at least one role mapped to that group, and removed when they have none. Account verification continues to work normally when LuckPerms is not installed; only role synchronization is disabled.
Server-status panel
When serverStatusChannelId is configured, wsnAuth publishes one Discord Embed containing:
- The online or offline state of every backend server registered in Velocity
- Visible player names and player counts
- The number of currently available backend servers
- An offline status when the Velocity proxy shuts down
The status is checked every five seconds, and the Discord message is updated only when its contents change. Vanished players are excluded when PremiumVanish is installed.
Security and data
- Verified account links are stored in
plugins/wsnauth/verified.json.
- Verification codes are held only in memory and are cleared when Velocity restarts.
- Codes contain six digits, expire after five minutes, and can be used only once.
- Invalid submissions are rate-limited per Discord account.
- A verified player who leaves the configured Discord server cannot connect until they rejoin.
- Never publish your Bot Token or
verified.json.
日本語
wsnAuth は、Minecraft アカウントと Discord アカウントを連携し、認証済みプレイヤーのみが参加できるようにする Velocity 用プラグインです。
未認証のプレイヤーが接続すると、Minecraft の切断画面に6桁の認証コードが表示されます。Discord の認証チャンネルでボタンを押し、表示されたフォームにコードを入力するだけで連携できます。
主な機能
- 6桁のワンタイムコードによる Minecraft / Discord アカウント認証
- 認証済みプレイヤーの接続時に Discord サーバーへの参加状況を確認
- 認証済み Discord ロールの自動付与・削除
- Discord ロールと LuckPerms グループの同期
- Velocity 配下のサーバーを表示する Discord ライブステータス
- PremiumVanish と連携し、Vanish 中のプレイヤーをステータスから除外
- 1つの Discord アカウントへ連携できる Minecraft アカウント数の制限
- 無効な認証コードの連続入力に対する一時ブロック
messages.yml による Minecraft / Discord メッセージの変更
- JSON による認証済みアカウントの保存
必要環境
- Java 17 以上
- Velocity 3.4.x
- Discord Bot
- LuckPerms 5.4 以上 — ロール同期を利用する場合のみ
- PremiumVanish — ステータス上で Vanish 中のプレイヤーを隠す場合のみ
Velocity の online-mode は true にしてください。オフライン UUID を利用する構成では、アカウントの所有者を安全に識別できません。
導入方法
- プラグインの JAR をダウンロードします。
- Velocity の
plugins ディレクトリへ配置します。
- Velocity を一度起動し、設定ファイルを生成します。
- Velocity を停止して
plugins/wsnauth/config.yml を編集します。
- Velocity を再度起動します。
初回起動時は Bot Token が初期値のため、Discord への接続エラーが表示されます。これは正常な動作です。生成された設定ファイルへ正しい Token を設定してから再起動してください。
Discord Bot の準備
Discord Developer Portal で Bot を作成し、次の設定を行ってください。
-
Bot 設定の Server Members Intent を有効にします。
-
認証に利用する Discord サーバーへ Bot を招待します。
-
Bot に以下の権限を付与します。
- チャンネルを見る
- メッセージを送信
- メッセージ履歴を読む
- 埋め込みリンク — サーバーステータスを利用する場合
- ロールの管理 — 認証済みロールを利用する場合
-
ロールを自動付与する場合は、Bot のロールを付与対象ロールより上に配置してください。
設定例
discord:
token: "YOUR_BOT_TOKEN_HERE"
guildId: 123456789012345678
adminId: 0
verificationChannelId: 123456789012345678
verifiedRoleId: 123456789012345678
serverStatusChannelId: 123456789012345678
inviteUrl: "https://discord.gg/your-invite"
security:
maxFailures: 3
blockMinutes: 5
maxAccountsPerUser: 1
debug: false
role-sync:
- roleId: 111111111111111111
group: "member"
- roleId: 222222222222222222
group: "vip"
任意機能の Discord ID を 0 にすると、その機能を無効化できます。LuckPerms ロール同期が不要な場合は role-sync: [] にしてください。
ステータスチャンネルは環境変数 SERVER_STATUS_CHANNEL_ID でも指定できます。環境変数が設定されている場合は config.yml より優先されます。
認証の流れ
- Minecraft サーバーへ接続します。
- 切断画面に表示された6桁のコードを確認します。
- 設定された Discord サーバーへ参加します。
- 認証チャンネルの 認証を開始 ボタンを押します。
- 表示されたフォームにコードを入力します。
- 認証完了後、Minecraft サーバーへ再接続します。
認証コードの有効期限は5分で、1回だけ使用できます。期限切れや使用済みの場合は、Minecraft サーバーへ接続し直して新しいコードを取得してください。
コマンド
| コマンド |
権限 |
説明 |
/unlink |
なし |
自分の Minecraft / Discord 連携を解除します |
/discord <player> |
discordauth.admin |
指定プレイヤーの Discord ユーザー名、ID、認証日時を表示します |
LuckPerms ロール同期
role-sync の各項目で Discord ロールと LuckPerms グループを対応させることができます。同期は以下のタイミングで実行されます。
- Discord ロールが追加・削除されたとき
- 認証済みプレイヤーが Minecraft へ接続したとき
- Minecraft / Discord 認証が完了したとき
同じ LuckPerms グループに対応する Discord ロールを1つ以上持っている間はグループが付与され、すべて失うと削除されます。LuckPerms が導入されていなくてもアカウント認証は利用でき、ロール同期のみが無効になります。
サーバーステータス
serverStatusChannelId を設定すると、1つの Discord Embed に以下の情報を表示します。
- Velocity に登録された各バックエンドサーバーのオンライン・オフライン状態
- 表示中のプレイヤー名と人数
- 稼働中のバックエンドサーバー数
- Velocity 停止時のオフライン状態
ステータスは5秒ごとに確認し、内容が変化した場合のみ Discord メッセージを更新します。PremiumVanish が導入されている場合は、Vanish 中のプレイヤーを除外します。
セキュリティとデータ
- 認証済みアカウントは
plugins/wsnauth/verified.json に保存されます。
- 認証コードはメモリ上にのみ保存され、Velocity の再起動時に消去されます。
- コードは6桁で、有効期限は5分、1回限り有効です。
- 無効なコードの入力は Discord アカウント単位で制限されます。
- 認証済みユーザーが対象の Discord サーバーから退出すると、再参加するまで接続できません。
- Bot Token や
verified.json は公開しないでください。
License
wsnAuth is released under the MIT License.
评论 0
登录后参与评分
还没有评论,来抢沙发吧