Class SkoiceAPI

java.lang.Object
net.clementraynaud.skoice.common.SkoiceAPI

public class SkoiceAPI extends Object
The main Skoice API interface.

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:
  • Skoice.api()
  • Method Details

    • getLinkedAccounts

      public Map<String,String> getLinkedAccounts()
      Gets all linked Minecraft-Discord account pairs.

      The returned map is immutable and maps Minecraft UUIDs (as strings) to Discord user IDs.

      Returns:
      an immutable map of Minecraft UUID strings to Discord IDs
    • linkUser

      public boolean linkUser(UUID minecraftId, String discordId)
      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 UUID
      discordId - the Discord user's ID
      Returns:
      true if the link was created successfully, false if either account is already linked
    • unlinkUser

      public boolean unlinkUser(UUID minecraftId)
      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

      public boolean isLinked(UUID minecraftId)
      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

      public boolean isLinked(String discordId)
      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

      public boolean isProximityConnected(UUID minecraftId)
      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

      public Set<UUID> getProximityConnectedPlayers()
      Gets all players currently connected to proximity voice chat.

      The returned set is immutable and contains the UUIDs of all players connected to proximity chat.

      Returns:
      an immutable set of player UUIDs connected to proximity chat
    • 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 SystemReadyEvent and SystemInterruptionEvent to be notified when the system state changes.

      Returns:
      true if proximity voice chat is actively running, false otherwise