Class SkoiceAPI
This class provides methods for interacting with Skoice's core functionality, including account linking, proximity chat status, and system state queries.
Access the API instance through Skoice.api().
Example usage:
SkoiceAPI api = Skoice.api();
if (api != null && api.isSystemReady()) {
UUID playerUuid = player.getUniqueId();
// Check if player is connected to proximity chat
if (api.isProximityConnected(playerUuid)) {
// Player is in proximity chat
}
// Check if player has linked their Discord account
if (api.isLinked(playerUuid)) {
// Player has linked their account
}
}
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionGets all linked Minecraft-Discord account pairs.Gets all players currently connected to proximity voice chat.booleanChecks if a Discord user has linked their Minecraft account.booleanChecks if a Minecraft player has linked their Discord account.booleanisProximityConnected(UUID minecraftId) Checks if a player is currently connected to proximity voice chat.booleanChecks if the proximity voice chat system is actively running.booleanLinks a Minecraft account to a Discord account.booleanunlinkUser(UUID minecraftId) Unlinks a Minecraft account from its associated Discord account.
-
Method Details
-
getLinkedAccounts
-
linkUser
Links a Minecraft account to a Discord account.This method will fail if either the Minecraft UUID is already linked to another Discord account, or if the Discord ID is already linked to another Minecraft account.
When successful, this will not trigger an
AccountLinkEvent.- Parameters:
minecraftId- the Minecraft player's UUIDdiscordId- the Discord user's ID- Returns:
- true if the link was created successfully, false if either account is already linked
-
unlinkUser
Unlinks a Minecraft account from its associated Discord account.This method will fail if the Minecraft UUID is not currently linked.
When successful, this will not trigger an
AccountUnlinkEvent.- Parameters:
minecraftId- the Minecraft player's UUID- Returns:
- true if the account was unlinked successfully, false if the account was not linked
-
isLinked
Checks if a Minecraft player has linked their Discord account.- Parameters:
minecraftId- the Minecraft player's UUID- Returns:
- true if the player has a linked Discord account, false otherwise
-
isLinked
Checks if a Discord user has linked their Minecraft account.- Parameters:
discordId- the Discord user's ID- Returns:
- true if the Discord user has a linked Minecraft account, false otherwise
-
isProximityConnected
Checks if a player is currently connected to proximity voice chat.A player is considered proximity connected when they are linked and connected to either the main voice channel or a proximity channel.
- Parameters:
minecraftId- the Minecraft player's UUID- Returns:
- true if the player is connected to proximity chat, false otherwise
-
getProximityConnectedPlayers
-
isSystemReady
public boolean isSystemReady()Checks if the proximity voice chat system is actively running.The system is ready when the Discord bot is connected and proximity voice chat is operational. This is useful for features that should only activate when proximity chat is available, such as enforcing voice chat requirements.
Listen to
SystemReadyEventandSystemInterruptionEventto be notified when the system state changes.- Returns:
- true if proximity voice chat is actively running, false otherwise
-