Packages com.phoenixplugins.phoenixcrates.api managers

Interface PlayersManager


public interface PlayersManager
Class for managing player data lifecycle and access.

Implementations handle caching, persistence, and disposal internally. Consumers should use only these methods to fetch or interact with PlayerData.

  • Method Summary

    Modifier and Type
    Method
    Description
    CompletableFuture<? extends PlayerData>
    fetchPlayerDataAsync(org.bukkit.OfflinePlayer player)
    Fetches player data asynchronously, caching it if necessary.
    getCachedDataNow(org.bukkit.entity.Player player)
    Gets cached data for an online player immediately, throwing if not present.
    getPlayerIfCached(org.bukkit.OfflinePlayer player, boolean requestCache)
    Gets cached player data immediately if available.
    boolean
    isDataCached(org.bukkit.OfflinePlayer player)
    Checks whether the player's data is currently cached.
    void
    Sets the player data layer for this manager.
  • Method Details

    • fetchPlayerDataAsync

      CompletableFuture<? extends PlayerData> fetchPlayerDataAsync(org.bukkit.OfflinePlayer player)
      Fetches player data asynchronously, caching it if necessary.

      If the data is already cached, the future completes immediately with the cached data. Otherwise, the data is loaded from the database asynchronously and cached.

      A timeout is enforced: if the load takes too long, the future completes exceptionally.
      Parameters:
      player - the offline player
      Returns:
      a future completing with the player's data
    • getPlayerIfCached

      PlayerData getPlayerIfCached(org.bukkit.OfflinePlayer player, boolean requestCache)
      Gets cached player data immediately if available.

      If not cached and requestCache is true, this triggers an asynchronous fetch in the background, but still returns null immediately.

      Parameters:
      player - the offline player
      requestCache - whether to start an async fetch if not cached
      Returns:
      the cached player data, or null if not cached
    • getCachedDataNow

      PlayerData getCachedDataNow(org.bukkit.entity.Player player)
      Gets cached data for an online player immediately, throwing if not present.

      This is a strict access method intended for contexts where player data is guaranteed to be available (e.g., events after login).

      Parameters:
      player - the online player
      Returns:
      the cached data
      Throws:
      IllegalStateException - if the data is not cached
    • isDataCached

      boolean isDataCached(org.bukkit.OfflinePlayer player)
      Checks whether the player's data is currently cached.
      Parameters:
      player - the offline player
      Returns:
      true if cached, false otherwise
    • setPlayerDataLayer

      void setPlayerDataLayer(PlayerDataLayer layer)
      Sets the player data layer for this manager.

      This allows addons to inject custom data layers (e.g., Redis caching layer) between the local cache and database.

      Parameters:
      layer - the data layer to use, or null to use default direct database layer
Last updated 22 days ago
My Cart
Spider

Your cart is empty

Looks like the spiders padded through here. Pick a plugin and it will show up here. Continue shopping