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
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
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 Summary
Modifier and TypeMethodDescriptionvoid
clearAll()
Clears the cache of all storagesGets all the cachedPokemonStorage
this implementation is storingGets the player's party waiting until it is loaded from the file if necessarydefault CompletableFuture<PlayerPartyStorage>
getParty
(net.minecraft.server.level.ServerPlayer player) Gets the player's party waiting until it is loaded from the file if necessarydefault PlayerPartyStorage
getPartyNow
(UUID uuid) Gets the player's partydefault PlayerPartyStorage
getPartyNow
(net.minecraft.server.level.ServerPlayer player) Gets the player's partydefault 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 necessarygetPCForPlayer
(UUID uuid) Gets the PC for the player waiting until it is loaded from file, if necessarydefault CompletableFuture<PCStorage>
getPCForPlayer
(net.minecraft.server.level.ServerPlayer player) Gets the PC for the player waiting until it is loaded from file, if necessarydefault PCStorage
getPCForPlayerNow
(UUID uuid) Gets the PC for the player with the given UUIDdefault PCStorage
getPCForPlayerNow
(net.minecraft.server.level.ServerPlayer player) Gets the PC for the given player entitydefault PCStorage
getPCNow
(net.minecraft.server.level.ServerPlayer player, PCTileEntity pc) Gets the player's PC for the given tile entitydefault CompletableFuture<Pokemon>
getPokemon
(net.minecraft.server.level.ServerPlayer player, StoragePosition position) Gets a Pokemon using theStoragePosition
default CompletableFuture<PokemonStorage>
getStorage
(net.minecraft.server.level.ServerPlayer player, StoragePosition position) Gets the storage of a player based on theStoragePosition
default PokemonStorage
getStorageNow
(net.minecraft.server.level.ServerPlayer player, StoragePosition position) Gets the storage of a player based on theStoragePosition
void
invalidateCache
(PokemonStorage storage) Removes the cache of the given storage
-
Method Details
-
getAllCachedStorages
Iterable<PokemonStorage> getAllCachedStorages()Gets all the cachedPokemonStorage
this implementation is storing- Returns:
- The cached storages
-
clearAll
void clearAll()Clears the cache of all storages -
getPCForPlayerNow
Gets the PC for the given player entity- Parameters:
player
- The player- Returns:
- The PC storage
-
getPCForPlayer
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
Gets the PC for the player with the given UUID- Parameters:
uuid
- The UUID of the player- Returns:
- The PC
-
getPCForPlayer
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 playerpc
- 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 playerpc
- the PC tile entity- Returns:
- The future PC storage
-
getPartyNow
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
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
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 theStoragePosition
- Parameters:
player
- The playerposition
- 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 theStoragePosition
- Parameters:
player
- The playerposition
- the position- Returns:
- The future storage
-
getPokemon
default CompletableFuture<Pokemon> getPokemon(net.minecraft.server.level.ServerPlayer player, StoragePosition position) Gets a Pokemon using theStoragePosition
- Parameters:
player
- The playerposition
- the position- Returns:
- The future pokemon
-