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 player
com.phoenixplugins.phoenixcrates.api.player

Interface PlayerDataLayer



  • public interface PlayerDataLayer
    Represents a data layer that can decide whether to return its own cached data or fetch from the next layer (typically database).

    This follows the Chain of Responsibility pattern, allowing layers to be composed. Each layer can intercept data operations and either return cached data or delegate to the next layer in the chain.

    • Method Detail

      • fetchByUniqueId

        CompletableFuture<? extends PlayerDbModel> fetchByUniqueId(UUID uniqueId)
        Fetches player data by unique ID.

        The layer decides whether to return cached data or fetch from the next layer.

        Parameters:
        uniqueId - the player's unique ID
        Returns:
        a future completing with the player's database model, or null if not found
      • insert

        <T extends PlayerDbModel> CompletableFuture<T> insert(T model)
        Inserts new player data.

        The layer can cache the data after the insert operation completes.

        Parameters:
        model - the player database model to insert
        Returns:
        a future completing with the inserted model (with generated ID)
      • update

        <T extends PlayerDbModel> CompletableFuture<Void> update(T model)
        Updates player data.

        The layer can update its cache before passing the update to the next layer.

        Parameters:
        model - the player database model to update
        Returns:
        a future completing when the update operation is done
      • setNextLayer

        void setNextLayer(PlayerDataLayer nextLayer)
        Sets the next layer in the chain.

        This allows layers to be composed in a chain of responsibility pattern.

        Parameters:
        nextLayer - the next layer to delegate to, or null to remove the chain
      • getNextLayer

        PlayerDataLayer getNextLayer()
        Gets the next layer in the chain.
        Returns:
        the next layer, or null if this is the last layer
      • dispose

        default CompletableFuture<Void> dispose(UUID uniqueId,
                                                PlayerDbModel model,
                                                boolean isDirty)
        Handles disposal of player data.

        This is called when player data is being unloaded from memory. The layer should release any locks and update Redis if the data is dirty.

        Parameters:
        uniqueId - the player's unique ID
        model - the player database model (may be null)
        isDirty - whether the data is dirty and needs to be saved
        Returns:
        a future completing when the disposal operation is done
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