API interface for interacting with EssentialsC's DiscordSRV integration. Lets external plugins push event embeds to the configured Discord punishment channel through EssentialsC's existing DiscordSRV connection. All send methods are no-ops if DiscordSRV is not hooked.
Retrieve an instance via EssentialsCAPI.getDiscordApi().
DiscordApi discord = APIProvider.getAPI().getDiscordApi();
if (discord.isHooked()) {
discord.sendBanEmbed(
player.getUniqueId(), player.getName(),
"Cheating", "AdminName", -1L // -1 = permanent
);
}
Method Summary
| boolean |
isHooked() Returns whether the DiscordSRV hook is fully established and ready. |
| void |
sendBanEmbed(UUID targetUUID, String targetName, String reason, String banner, long expires) Sends a ban notification embed to the configured Discord channel. |
| void |
sendKickEmbed(UUID targetUUID, String targetName, String reason, String kicker) Sends a kick notification embed to the configured Discord channel. |
| void |
sendMuteEmbed(UUID targetUUID, String targetName, String reason, String muter, long expires) Sends a mute notification embed to the configured Discord channel. |
| void |
sendHomeSetEmbed(UUID playerUUID, String playerName, String homeName, String worldName, int homeCount, int maxHomes) Sends a home-set notification embed to the configured Discord channel. |
| void |
sendHomeDeleteEmbed(UUID playerUUID, String playerName, String homeName, int remainingHomes, int maxHomes) Sends a home-deleted notification embed to the configured Discord channel. |
Returns whether the DiscordSRV hook is fully established and the JDA instance is available.
This is false if DiscordSRV is not installed, if the Discord bot has not yet connected, or if DiscordSRV integration is disabled in the EssentialsC config. All send* methods silently do nothing when this returns false.
| boolean | true if DiscordSRV is connected and ready to send messages |
Sends a ban notification embed to the configured Discord punishments channel. Has no effect if isHooked() is false.
| targetUUID | the UUID of the banned player; must not be null |
| targetName | the name of the banned player; must not be null |
| reason | the ban reason displayed in the embed; must not be null |
| banner | the name of the staff member or console who issued the ban; must not be null |
| expires | the Unix timestamp (milliseconds) when the ban expires, or -1 for permanent |
Sends a kick notification embed to the configured Discord punishments channel. Has no effect if isHooked() is false.
| targetUUID | the UUID of the kicked player; must not be null |
| targetName | the name of the kicked player; must not be null |
| reason | the kick reason displayed in the embed; must not be null |
| kicker | the name of the staff member or console who issued the kick; must not be null |
Sends a mute notification embed to the configured Discord punishments channel. Has no effect if isHooked() is false.
| targetUUID | the UUID of the muted player; must not be null |
| targetName | the name of the muted player; must not be null |
| reason | the mute reason displayed in the embed; must not be null |
| muter | the name of the staff member or console who issued the mute; must not be null |
| expires | the Unix timestamp (milliseconds) when the mute expires, or -1 for permanent |
Sends a home-set notification embed to the configured Discord channel. Has no effect if isHooked() is false.
| playerUUID | the UUID of the player who set the home; must not be null |
| playerName | the name of the player; must not be null |
| homeName | the name given to the new home; must not be null |
| worldName | the name of the world the home was set in; must not be null |
| homeCount | the player's total number of homes after setting this one |
| maxHomes | the player's current home limit |
Sends a home-deleted notification embed to the configured Discord channel. Has no effect if isHooked() is false.
| playerUUID | the UUID of the player who deleted the home; must not be null |
| playerName | the name of the player; must not be null |
| homeName | the name of the home that was deleted; must not be null |
| remainingHomes | the number of homes the player has left after the deletion |
| maxHomes | the player's current home limit |