Interface ResearchStorageManager

All Known Implementing Classes:
SimpleResearchStorageManager

public interface ResearchStorageManager
The storage manager is the class that needs to be implemented for handling the load and saving of the player's research data
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 research storage 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<ResearchStorage> getAllCachedStorages()
      Gets all the cached ResearchStorage this implementation is storing
      Returns:
      The cached storages
    • clearAll

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

      @Nullable default ResearchStorage getStorageNow(net.minecraft.server.level.ServerPlayer player)
      Gets the player's research storage
      Parameters:
      player - The player
      Returns:
      The research storage
    • getStorage

      default CompletableFuture<ResearchStorage> getStorage(net.minecraft.server.level.ServerPlayer player)
      Gets the player's research storage waiting until it is loaded from the file if necessary
      Parameters:
      player - The player
      Returns:
      The future research storage
    • getStorageNow

      @Nullable default ResearchStorage getStorageNow(UUID uuid)
      Gets the player's research storage
      Parameters:
      uuid - The player
      Returns:
      The research storage
    • getStorage

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

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