Interface PokeDexStorageManager
- All Known Implementing Classes:
SimplePokeDexStorageManager
public interface PokeDexStorageManager
The storage manager is the class that needs to be implemented
for handling the load and saving of the player's pokedex data
It's recommended that you use the methods that return
However, there are equivalent methods that return the pokdex 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 pokdex 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 cachedPokedexStorage
this implementation is storinggetStorage
(UUID uuid) Gets the player's pokdex storage waiting until it is loaded from the file if necessarydefault CompletableFuture
<PokedexStorage> getStorage
(net.minecraft.server.level.ServerPlayer player) Gets the player's pokdex storage waiting until it is loaded from the file if necessarydefault PokedexStorage
getStorageNow
(UUID uuid) Gets the player's pokdex storagedefault PokedexStorage
getStorageNow
(net.minecraft.server.level.ServerPlayer player) Gets the player's pokdex storagevoid
invalidateCache
(PokedexStorage storage) Removes the cache of the given storage
-
Method Details
-
getAllCachedStorages
Iterable<PokedexStorage> getAllCachedStorages()Gets all the cachedPokedexStorage
this implementation is storing- Returns:
- The cached storages
-
clearAll
void clearAll()Clears the cache of all storages -
getStorageNow
Gets the player's pokdex storage- Parameters:
player
- The player- Returns:
- The pokdex storage
-
getStorage
default CompletableFuture<PokedexStorage> getStorage(net.minecraft.server.level.ServerPlayer player) Gets the player's pokdex storage waiting until it is loaded from the file if necessary- Parameters:
player
- The player- Returns:
- The future pokdex storage
-
getStorageNow
Gets the player's pokdex storage- Parameters:
uuid
- The player- Returns:
- The pokdex storage
-
getStorage
Gets the player's pokdex storage waiting until it is loaded from the file if necessary- Parameters:
uuid
- The player- Returns:
- The future pokdex storage
-
invalidateCache
Removes the cache of the given storage- Parameters:
storage
- The storage to remove
-