EssentialsX Discord Link
Note: EssentialsX Discord Link is still in beta! See https://github.com/EssentialsX/Essentials/pull/4155 for more information.
EssentialsX Discord Link is an addon for EssentialsX Discord which provides numerous features related to group/role synchronization.
EssentialsX Discord Link offers features such as:
- Vault Group -> Discord Role Synchronization
- Discord Role -> Vault Group Synchronization
- Prevent unlinked players from joining
- Prevent unlinked players from moving/chatting
- & more...
Table of Contents
Setting Up Role Sync
In EssentialsX Discord Link, you can define a synchronizations for both Vault groups -> Discord roles and for Discord roles -> Vault groups.
The following tutorial (as an example) will show how to give players with the Discord role Patreon the donator
Vault group and how to give players with the vip Vault group the VIP Discord role.
First, head to your server's role page in order to get their IDs.
For both the
PatreonandVIProle, right click them and click on "Copy ID".
Right Click on Role(s) -> Copy ID-> Paste into Notepad for later stepNow that you have the IDs you need from Discord, you can begin configuring the plugin.
First place the EssentialsX Discord Link jar (you can download it here if you do not already have it) in your plugins folder and then start your server.
Drag EssentialsXDiscordLink jar into plugins folder -> Start ServerOnce the server started, open the config for EssentialsX Discord Link at
plugins/EssentialsDiscordLink/config.yml.
Once opened, putgroup-name: role-idin thegroupssection to create a Vault group -> Discord role synchronization (vip: 882835722640433242for this example).
Then, putrole-id: group-namein therolessection to create a Discord role -> Vault group synchronization (882835662280224818: donatorfor this example).
When done, save the file.
Paste Vault->Discord syncs in the group section & Discord->Vault syncs in the roles sectionFinally, once the file is saved, run
ess reloadfrom your console and then linked accounts should now have their groups/roles linked between Minecraft/Discord! Now that you completed the basics of group/role syncing, go back up to the Table of Contents to see what else you can do!
Linking an Account
This assumes the server has started and you have joined the server.
Once on the server, run
/linkin Minecraft and take note of the code if gives you.
Run/linkin MinecraftNext, all you have to do is run the
/linkcommand in discord with the code provided.
Run/linkwith the code in DiscordThat's it! Now that you've learned how to link an account, go back up to the Table of Contents to see what else you can do!
Developer API
EssentialsX Discord Link has a simple API to provide very simple methods to check if players are linked, link players, unlink players, and to get linked player data.
Outside the specific examples below, you can also view javadocs for EssentialsX Discord Link here.
Get a linked player's Discord tag
The following example shows how to get a linked player's Discord tag (in Name#0000 format) or null if the player
isn't linked.
public String getDiscordTag(final Player player) {
// Gets the API service for EssentialsX Discord Link
final DiscordLinkService linkApi = Bukkit.getServicesManager().load(DiscordLinkService.class);
final String discordId = linkApi.getDiscordId(player.getUniqueId());
if (discordId == null) {
return null;
}
// Gets the API service for EssentialsX Discord which we will use to get the actual user
final DiscordService discordApi = Bukkit.getServicesManager().load(DiscordService.class);
final InteractionMember member = discordApi.getMemberById(discordId).join();
return member == null ? null : member.getTag();
}