# Linking

## Usage

Allows players to link their Minecraft and Discord account.

## Setup

1. Optional: Migrate existing links via `/discordbridge account admin migrate`.
2. If you want to limit who can link their Minecraft accounts, setup allowed roles by executing `/config linking_allowed_roles add <role>` in the Discord server.
3. You can setup roles to be given to linked players in Discord, by executing `/config linking_roles add` in the Discord server. If you add a role, it will be given to existing linked players as well. This might take a while though, since updates are scheduled to improve the experience for large servers. If you remove a role, you need to manually remove this role from its members, if you wish to.
4. You can setup [LuckPerms](https://www.spigotmc.org/resources/luckperms.28140/) groups to be given to linked players in-game, by executing `/config linking_groups add` in the Discord server. If you add a group, it will be given to existing linked players as well. This might take a while though, since updates are scheduled to improve the experience for large servers. If you remove a group, you need to manually remove this group from its members, if you wish to.

### Name Sync Exclude Users

You can exclude users from name sync with the `/config linking_name_sync_ignore_roles add <role>` command in the Discord server. If a user has any of these roles, their name won't be synchronized with the in-game player.

## Ingame Commands

`/discordbridge acccount link`\
Link Discord and Minecraft account.\
\&#xNAN;*Permission: discordbridge.command.account.link*

`/discordbridge acccount unlink`\
Unlink your Discord account.\
\&#xNAN;*Permission: discordbridge.command.account.unlink*

### Administrator Commands

`/discordbridge account admin migrate`\
Migrate linked accounts from another plugin.\
\&#xNAN;*Permission: discordbridge.admin.command.account.admin.migrate*

## PlaceholderAPI Placeholders

Requires [PlaceholderAPI](https://www.spigotmc.org/resources/placeholderapi.6245/) to be installed.

`%discordbridge_module_linking_amount%`\
The amount of players that have linked their accounts.

`%discordbridge_module_linking_user_state_bool%`\
Returns `true` if the player has their account linked and `false`, if their account isn't linked.

`%discordbridge_module_linking_user_state%`\
Whether the account is linked. Returns entry from the locale file.

`%discordbridge_module_linking_user_id%`\
Returns the ID of the linked Discord user.

`%discordbridge_module_linking_user_name%`\
Returns the name of the linked Discord user.

`%discordbridge_module_linking_user_booster%`\
Returns whether user has boosted any server that the bot is added to.

`%discordbridge_module_linking_user_booster_bool%`\
Returns `true` if the player has boosted any server that the bot is added to and `false`, if they didn't boost any server.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.incredibleplugins.com/discordbridge/modules/linking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
