Interface StatsAPI


public interface StatsAPI
  • Method Summary

    Modifier and Type
    Method
    Description
    get(@NotNull org.bukkit.entity.Player player, DataType type)
    Gets a player's statistics asynchronously for a specific DataType.
    <T> T
    getSync(@NotNull org.bukkit.entity.Player player, DataType type)
    Gets a player's statistics synchronously for a specific DataType.
    load(@NotNull UUID uuid)
    Loads a player's statistics asynchronously using the player's UUID.
    load(@NotNull org.bukkit.entity.Player player)
    Loads a player's statistics asynchronously using the player's Player object.
    void
    load(@NotNull org.bukkit.entity.Player player, Consumer<CloudPlayerData> callback)
    Loads a player's statistics asynchronously using the player's Player object and executes a callback with the results.
    void
    save(@NotNull org.bukkit.entity.Player player)
    Saves a player's statistics cache to the database asynchronously.
    Saves all player data in the cache to the database asynchronously.
    void
    set(@NotNull org.bukkit.entity.Player player, DataType type, Object value)
    Sets a player's statistics asynchronously.
    void
    unload(@NotNull org.bukkit.entity.Player player)
    Unloads a player's statistics from the cache.
  • Method Details

    • load

      CompletableFuture<CloudPlayerData> load(@NotNull @NotNull org.bukkit.entity.Player player)
      Loads a player's statistics asynchronously using the player's Player object.

      This method fetches the player's statistics from the database or cache.

      Parameters:
      player - The player whose statistics are to be loaded.
      Returns:
      A CompletableFuture containing the loaded CloudPlayerData for the player.
    • load

      CompletableFuture<CloudPlayerData> load(@NotNull @NotNull UUID uuid)
      Loads a player's statistics asynchronously using the player's UUID.

      This method fetches the player's statistics from the database or cache.

      Parameters:
      uuid - The UUID of the player whose statistics are to be loaded.
      Returns:
      A CompletableFuture containing the loaded CloudPlayerData for the player.
    • load

      void load(@NotNull @NotNull org.bukkit.entity.Player player, Consumer<CloudPlayerData> callback)
      Loads a player's statistics asynchronously using the player's Player object and executes a callback with the results.

      This method fetches the player's statistics and provides them via the callback.

      Parameters:
      player - The player whose statistics are to be loaded.
      callback - The callback to execute once the player's statistics are loaded.
    • set

      void set(@NotNull @NotNull org.bukkit.entity.Player player, DataType type, Object value)
      Sets a player's statistics asynchronously.

      This method updates the player's statistics for a specific DataType and the given value.

      Parameters:
      player - The player whose statistics are to be updated.
      type - The type of data being set (e.g., kills, wins, losses).
      value - The value to set for the specified DataType.
    • get

      <T> CompletableFuture<T> get(@NotNull @NotNull org.bukkit.entity.Player player, DataType type)
      Gets a player's statistics asynchronously for a specific DataType.

      This method fetches the player's statistics for a specific data type.

      Type Parameters:
      T - The type of value returned for the specified DataType.
      Parameters:
      player - The player whose statistics are to be retrieved.
      type - The type of data being retrieved (e.g., kills, wins, losses).
      Returns:
      A CompletableFuture containing the value of the specified DataType for the player.
    • getSync

      <T> T getSync(@NotNull @NotNull org.bukkit.entity.Player player, DataType type)
      Gets a player's statistics synchronously for a specific DataType.

      This method fetches the player's statistics for a specific data type in a blocking manner.

      Type Parameters:
      T - The type of value returned for the specified DataType.
      Parameters:
      player - The player whose statistics are to be retrieved.
      type - The type of data being retrieved (e.g., kills, wins, losses).
      Returns:
      The value of the specified DataType for the player.
    • save

      void save(@NotNull @NotNull org.bukkit.entity.Player player)
      Saves a player's statistics cache to the database asynchronously.

      This method saves the player's current statistics from the cache to the database.

      Parameters:
      player - The player whose statistics cache is to be saved.
    • saveAll

      Saves all player data in the cache to the database asynchronously.

      This method saves the statistics for all players in the cache to the database.

      Returns:
      A CompletableFuture indicating when the saving process is complete.
    • unload

      void unload(@NotNull @NotNull org.bukkit.entity.Player player)
      Unloads a player's statistics from the cache.

      This method removes the player's statistics from the cache, typically when the player disconnects.

      Parameters:
      player - The player whose statistics are to be unloaded.