Interface StorageManager

All Known Implementing Classes:
PixelmonStorageManager

public interface StorageManager
The storage manager is the class that needs to be implemented for handling the load and saving of the player's party and PC
It's recommended that you use the methods that return CompletableFuture as these will not lock the main thread if the player's storage is still loading when you attempt to access it.
However, there are equivalent methods that return the PC/Party directly (usually suffixed with Now) and they will hold your current thread until the player's storage has finished loading from when they logged in (or whenever the access was first called) by default. This could vary with implementation so is worth checking
  • Method Details

    • getAllCachedStorages

      Iterable<PokemonStorage> getAllCachedStorages()
      Gets all the cached PokemonStorage this implementation is storing
      Returns:
      The cached storages
    • clearAll

      void clearAll()
      Clears the cache of all storages
    • getPCForPlayerNow

      @Nullable default PCStorage getPCForPlayerNow(net.minecraft.server.level.ServerPlayer player)
      Gets the PC for the given player entity
      Parameters:
      player - The player
      Returns:
      The PC storage
    • getPCForPlayer

      default CompletableFuture<PCStorage> getPCForPlayer(net.minecraft.server.level.ServerPlayer player)
      Gets the PC for the player waiting until it is loaded from file, if necessary
      Parameters:
      player - The player
      Returns:
      The future PC storage
    • getPCForPlayerNow

      @Nullable default PCStorage getPCForPlayerNow(UUID uuid)
      Gets the PC for the player with the given UUID
      Parameters:
      uuid - The UUID of the player
      Returns:
      The PC
    • getPCForPlayer

      CompletableFuture<PCStorage> getPCForPlayer(UUID uuid)
      Gets the PC for the player waiting until it is loaded from file, if necessary
      Parameters:
      uuid - The UUID of the player
      Returns:
      The future PC storage
    • getPCNow

      @Nullable default PCStorage getPCNow(net.minecraft.server.level.ServerPlayer player, PCTileEntity pc)
      Gets the player's PC for the given tile entity
      Parameters:
      player - The player
      pc - the PC tile entity
      Returns:
      The PC storage
    • getPC

      default CompletableFuture<PCStorage> getPC(net.minecraft.server.level.ServerPlayer player, PCTileEntity pc)
      Gets the player's PC for the given tile entity in the future, loading from file if necessary
      Parameters:
      player - The player
      pc - the PC tile entity
      Returns:
      The future PC storage
    • getPartyNow

      @Nullable default PlayerPartyStorage getPartyNow(net.minecraft.server.level.ServerPlayer player)
      Gets the player's party
      Parameters:
      player - The player
      Returns:
      The party
    • getParty

      default CompletableFuture<PlayerPartyStorage> getParty(net.minecraft.server.level.ServerPlayer player)
      Gets the player's party waiting until it is loaded from the file if necessary
      Parameters:
      player - The player
      Returns:
      The future party
    • getPartyNow

      @Nullable default PlayerPartyStorage getPartyNow(UUID uuid)
      Gets the player's party
      Parameters:
      uuid - The player
      Returns:
      The party
    • getParty

      Gets the player's party waiting until it is loaded from the file if necessary
      Parameters:
      uuid - The player
      Returns:
      The future party
    • invalidateCache

      void invalidateCache(PokemonStorage storage)
      Removes the cache of the given storage
      Parameters:
      storage - The storage to remove
    • getStorageNow

      default PokemonStorage getStorageNow(net.minecraft.server.level.ServerPlayer player, StoragePosition position)
      Gets the storage of a player based on the StoragePosition
      Parameters:
      player - The player
      position - the position
      Returns:
      The future storage
    • getStorage

      default CompletableFuture<PokemonStorage> getStorage(net.minecraft.server.level.ServerPlayer player, StoragePosition position)
      Gets the storage of a player based on the StoragePosition
      Parameters:
      player - The player
      position - the position
      Returns:
      The future storage
    • getPokemon

      default CompletableFuture<Pokemon> getPokemon(net.minecraft.server.level.ServerPlayer player, StoragePosition position)
      Gets a Pokemon using the StoragePosition
      Parameters:
      player - The player
      position - the position
      Returns:
      The future pokemon