Promotion background
Easter Season IS HERE!
10% off limited time offer!
Ends in
00
H
00
M
00
S
limited time offer SAVE 10% NOW →
Packages com.phoenixplugins.phoenixcrates.api managers
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 and Description
      CompletableFuture<? extends PlayerData> fetchPlayerDataAsync(org.bukkit.OfflinePlayer player)
      Fetches player data asynchronously, caching it if necessary.
      PlayerData getCachedDataNow(org.bukkit.entity.Player player)
      Gets cached data for an online player immediately, throwing if not present.
      PlayerData 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 setPlayerDataLayer(PlayerDataLayer layer)
      Sets the player data layer for this manager.
    • Method Detail

      • 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 about 3 hours ago
My Cart (0 items)

Oops... looks like the spiders padded through here

Add products to your cart and remove them from here Lets buy
This site uses cookies to personalize content, enhance your experience. By continuing, you agree to our cookie use. Learn more