API - Norbit4/DiscordMc GitHub Wiki

How to start?

Gradle

repositories {
    maven { url 'https://jitpack.io' }
}
dependencies {
    implementation 'com.github.Norbit4:DiscordMc:v1.4.1'
}

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.github.Norbit4</groupId>
    <artifactId>DiscordMc</artifactId>
    <version>v1.4.1</version>
</dependency>
  • add plugin DiscordMc to depends:
#plugin.yml
depend:
  - DiscordMc

Ex methods:

  • Get DiscordPlayer object:
DiscordPlayer discordPlayer = DiscordMcAPI.getDiscordPlayer(player.getUniqueId()); //get player by playerUUID

boolean sync = discordPlayer.isSync(); //is sync?

String discordName = discordPlayer.getDiscordName(); //discord name -> ex: BORBI

String discordFullName = discordPlayer.getDiscordFullName(); //discord name with # numbers -> ex: BORBI#2685

String discordId = discordPlayer.getDiscordId(); //discord id 

discordPlayer.sendDiscordMessage("Test message"); //send private message in discord
  • Is Sync:
boolean isSync = DiscordMcAPI.playerIsSync(player.getUniqueId());
  • Remove sync:
DiscordMcAPI.removeSync(player.getUniqueId());

Events:

public class ExampleListener implements Listener {

    @EventHandler
    public void onSync(SyncEvent e) {
        String discordID = e.getDiscordID();
        UUID playerUUID = e.getPlayerUUID();
    }

    @EventHandler
    public void onSyncClear(SyncClearEvent e) {
        String discordID = e.getDiscordID();
        UUID playerUUID = e.getPlayerUUID();
    }
}
    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new ExampleListener(), this);
    }
⚠️ **GitHub.com Fallback** ⚠️