Class StorageProxy
java.lang.Object
com.pixelmonmod.pixelmon.api.storage.StorageProxy
Static factory for managing pixelmon storage
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
clearAll()
Clears the cache of all storagesstatic Iterable<PokemonStorage>
Gets all the cachedPokemonStorage
this implementation is storingstatic CompletableFuture<PlayerPartyStorage>
Gets the player's party waiting until it is loaded from the file if necessarystatic CompletableFuture<PlayerPartyStorage>
getParty
(net.minecraft.server.level.ServerPlayer player) Gets the player's party waiting until it is loaded from the file if necessarystatic PlayerPartyStorage
getPartyNow
(UUID uuid) Gets the player's partystatic PlayerPartyStorage
getPartyNow
(net.minecraft.server.level.ServerPlayer player) Gets the player's partystatic 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 necessarystatic CompletableFuture<PCStorage>
getPCForPlayer
(UUID uuid) Gets the PC for the player waiting until it is loaded from file, if necessarystatic CompletableFuture<PCStorage>
getPCForPlayer
(net.minecraft.server.level.ServerPlayer player) Gets the PC for the player waiting until it is loaded from file, if necessarystatic PCStorage
getPCForPlayerNow
(UUID uuid) Gets the PC for the player with the given UUIDstatic PCStorage
getPCForPlayerNow
(net.minecraft.server.level.ServerPlayer player) Gets the PC for the given player entitystatic PCStorage
getPCNow
(net.minecraft.server.level.ServerPlayer player, PCTileEntity pc) Gets the player's PC for the given tile entitystatic CompletableFuture<Pokemon>
getPokemon
(net.minecraft.server.level.ServerPlayer player, StoragePosition position) Gets a Pokemon using theStoragePosition
static StorageSaveAdapter
Gives you the save adapter of the current storage manager.static StorageSaveScheduler
Gives you the save scheduler of the current storage manager.static CompletableFuture<PokemonStorage>
getStorage
(net.minecraft.server.level.ServerPlayer player, StoragePosition position) Gets the storage of a player based on theStoragePosition
static StorageManager
Gives you the current storage managerstatic PokemonStorage
getStorageNow
(net.minecraft.server.level.ServerPlayer player, StoragePosition position) Gets the storage of a player based on theStoragePosition
static void
invalidateCache
(PokemonStorage storage) Removes the storage from the cachestatic void
setSaveAdapter
(StorageSaveAdapter saveAdapter) Sets the implementation of the save adapter
Should ideally be set using thePixelmonInitEvent
static void
setSaveScheduler
(StorageSaveScheduler saveScheduler) Sets the implementation of the save scheduler
Should ideally be set using thePixelmonInitEvent
static void
setStorageManager
(StorageManager storageManager) Sets the implementation of the storage manager
Should ideally be set using thePixelmonInitEvent
-
Method Details
-
getStorageManager
Gives you the current storage manager- Returns:
- - The current storage manager
-
setStorageManager
Sets the implementation of the storage manager
Should ideally be set using thePixelmonInitEvent
- Parameters:
storageManager
- - The storage manager implementation
-
getSaveScheduler
Gives you the save scheduler of the current storage manager.- Returns:
- The save scheduler of the current storage manager.
-
setSaveScheduler
Sets the implementation of the save scheduler
Should ideally be set using thePixelmonInitEvent
- Parameters:
saveScheduler
- - The save scheduler implementation
-
getSaveAdapter
Gives you the save adapter of the current storage manager.- Returns:
- The save adapter of the current storage manager.
-
setSaveAdapter
Sets the implementation of the save adapter
Should ideally be set using thePixelmonInitEvent
- Parameters:
saveAdapter
- The new save adapter
-
getAllCachedStorages
Gets all the cachedPokemonStorage
this implementation is storing- Returns:
- The cached storages
-
clearAll
public static void clearAll()Clears the cache of all storages -
invalidateCache
Removes the storage from the cache- Parameters:
storage
- The storage to remove
-
getPCForPlayerNow
Gets the PC for the given player entity- Parameters:
player
- The player- Returns:
- The PC storage
-
getPCForPlayer
public static 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
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 public static 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
public static 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
@Nullable public static PlayerPartyStorage getPartyNow(net.minecraft.server.level.ServerPlayer player) Gets the player's party- Parameters:
player
- The player- Returns:
- The party
-
getParty
public static 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
-
getStorage
public static 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
-
getStorageNow
public static 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
-
getPokemon
public static 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
-