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
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
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 Summary
Modifier and TypeMethodDescriptionvoid
clearAll()
Clears the cache of all storagesGets all the cachedResearchStorage
this implementation is storinggetStorage
(UUID uuid) Gets the player's research storage waiting until it is loaded from the file if necessarydefault CompletableFuture<ResearchStorage>
getStorage
(net.minecraft.server.level.ServerPlayer player) Gets the player's research storage waiting until it is loaded from the file if necessarydefault ResearchStorage
getStorageNow
(UUID uuid) Gets the player's research storagedefault ResearchStorage
getStorageNow
(net.minecraft.server.level.ServerPlayer player) Gets the player's research storagevoid
invalidateCache
(ResearchStorage storage) Removes the cache of the given storage
-
Method Details
-
getAllCachedStorages
Iterable<ResearchStorage> getAllCachedStorages()Gets all the cachedResearchStorage
this implementation is storing- Returns:
- The cached storages
-
clearAll
void clearAll()Clears the cache of all storages -
getStorageNow
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
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
Removes the cache of the given storage- Parameters:
storage
- The storage to remove
-