-
Notifications
You must be signed in to change notification settings - Fork 0
Account Linking
The account linking system lets players connect their Minecraft identity to their Discord account. Once linked, all other features (rank sync, nicknames, boost rewards, 2FA, level rewards) work automatically.
Player Minecraft Server Discord
│ │ │
├─ /link ──────────────────► │ │
│ │ Generate 6-digit code │
│ ◄──── "Your code: 123456" ─┤ │
│ │ │
│ │ ◄─── Click "Link Account" button
│ │ │
│ │ ◄─── Enter code in modal
│ │ │
│ │ Validate code ──────────►│
│ │ Store linked_account │
│ │ Assign linked roles ─────►│
│ ◄──── "Account linked!" ───┤ │
- The player runs
/linkin Minecraft. - The server generates a unique 6-digit code and stores it in the database with an expiry time.
- The player goes to the designated Discord linking channel and clicks Link Account.
- A modal appears where they type in the 6-digit code.
- The plugin validates the code and, on success:
- Creates a record in the
linked_accountstable. - Assigns all configured
linked-role-idsin Discord. - Runs any configured post-link commands.
- Sends the player a confirmation message (in-game and optionally via DM).
- Records an audit log entry.
- Creates a record in the
All linking settings live in config.yml under discord.linking.
discord:
linking:
channel-id: "1234567890" # Channel where the Link Account button is posted
linked-role-ids: # Discord roles given to every linked player
- "9876543210"
code-expiration: 300 # Seconds the code remains valid (default: 5 minutes)
# Customise the embed posted in the linking channel
embed:
title: "Link Your Account"
description: "Run /link in-game to get your code, then click the button below."
color: "#5865F2"
footer: "Codes expire after 5 minutes."
# Customise the button
button:
label: "Link Account"
emoji: "🔗"
# Customise the code-entry modal
modal:
title: "Enter Verification Code"
input-label: "6-Digit Code"
input-placeholder: "123456"
# Commands run on the server after a successful link
# Supports %player_name%, %player_uuid%, %discord_id%
post-link-commands:
- "say Welcome to the server, %player_name%!"| Limit | Default | Config Key |
|---|---|---|
| Code requests per minute | 3 per player |
security.rate-limit.code-generation in advanced.yml
|
| Code expiry | 300 seconds | discord.linking.code-expiration |
Cooldown between /link uses |
30 seconds | Hardcoded |
Codes are one-time-use. Once redeemed, the code is immediately deleted from the database. Expired codes are automatically cleaned up.
Players can unlink their account with /unlink. When an account is unlinked:
- The
linked_accountsrecord is deleted. - All
linked-role-idsare removed from the Discord member. - The Discord nickname is reset (if nickname sync is enabled).
- An audit log entry is created.
If server-mode is set to shared, unlinking on any server unlinks on all servers. If set to separate, only the current server's link is removed.
/uxmdiscordsync forcelink <player> <discordId> # Link a player manually
/uxmdiscordsync forceunlink <player> # Unlink a player forcibly
These require the uxmdiscordsync.admin permission.
Configured in config.yml:
server:
name: "Survival"
link-mode: shared # "shared" (once across all) or "separate" (per-server)| Mode | Behaviour |
|---|---|
shared |
One link works on all servers using the same database |
separate |
Players must link separately on each server |
- Create a read-only channel (deny
Send Messagesfor@everyone). - Set the
channel-idin config. - On first start (or after
/uxmdiscordsync reload), the plugin posts the link embed with the button automatically. - The embed is persistent — the bot will repost it if it is deleted.
When audit-log is enabled, the following events are written to the audit webhook:
| Event | When |
|---|---|
LINK |
Successful account link |
UNLINK |
Account unlinked (player or admin) |
FORCE_LINK |
Admin force-linked an account |
FORCE_UNLINK |
Admin force-unlinked an account |
See Logging for webhook configuration.
⚙️ Setup
🔗 Core Systems
✨ Features
📋 Logging
💬 Commands
🔧 Advanced