Package wtf.choco.veinminer.data
Interface PersistentDataStorage
- All Known Implementing Classes:
PersistentDataStorageJSON
,PersistentDataStorageMySQL
,PersistentDataStorageNoOp
,PersistentDataStorageSQL
,PersistentDataStorageSQLite
public interface PersistentDataStorage
A means of storing persistent
VeinMinerPlayer
data.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Represents a support type of persistent storage. -
Method Summary
Modifier and TypeMethodDescription@NotNull PersistentDataStorage.Type
getType()
Get thePersistentDataStorage.Type
of persistent storage.@NotNull CompletableFuture<Void>
init()
Initialize this persistent storage.@NotNull CompletableFuture<List<VeinMinerPlayer>>
load
(@NotNull Collection<? extends VeinMinerPlayer> players) Load the data of the given list ofVeinMinerPlayers
from disk.@NotNull CompletableFuture<VeinMinerPlayer>
load
(@NotNull VeinMinerPlayer player) Load the data of the givenVeinMinerPlayer
from disk.@NotNull CompletableFuture<List<VeinMinerPlayer>>
save
(@NotNull Collection<? extends VeinMinerPlayer> players) Save the data of the given list ofVeinMinerPlayers
to disk.@NotNull CompletableFuture<VeinMinerPlayer>
save
(@NotNull VeinMinerPlayer player) Save the data of the givenVeinMinerPlayer
to disk.
-
Method Details
-
getType
Get thePersistentDataStorage.Type
of persistent storage.- Returns:
- the type
-
init
Initialize this persistent storage.- Returns:
- a
CompletableFuture
completed when the initialization has finished
-
save
Save the data of the givenVeinMinerPlayer
to disk.If the VeinMinerPlayer is not dirty (according to
VeinMinerPlayer.isDirty()
), this method will complete immediately and not perform a save.- Parameters:
player
- the player to save- Returns:
- a
CompletableFuture
completed when saving has finished
-
save
@NotNull @NotNull CompletableFuture<List<VeinMinerPlayer>> save(@NotNull @NotNull Collection<? extends VeinMinerPlayer> players) Save the data of the given list ofVeinMinerPlayers
to disk.- Parameters:
players
- the players to save- Returns:
- a
CompletableFuture
completed when saving has finished
-
load
Load the data of the givenVeinMinerPlayer
from disk.- Parameters:
player
- the player whose data to load- Returns:
- a
CompletableFuture
completed when loading has finished
-
load
@NotNull @NotNull CompletableFuture<List<VeinMinerPlayer>> load(@NotNull @NotNull Collection<? extends VeinMinerPlayer> players) Load the data of the given list ofVeinMinerPlayers
from disk.- Parameters:
players
- the players whose data to load- Returns:
- a
CompletableFuture
completed when loading has finished
-