Class WorldSaveData<T>
java.lang.Object
dev.scsupercraft.mc.libraries.corelib.api.data.SaveData<T>
dev.scsupercraft.mc.libraries.corelib.api.data.WorldSaveData<T>
- Type Parameters:
T- The type of the data being saved.
- All Implemented Interfaces:
Data<T>
- Direct Known Subclasses:
SyncedWorldSaveData
@AvailableSince("1.0.0")
public sealed class WorldSaveData<T>
extends SaveData<T>
permits SyncedWorldSaveData<T>
A helper class for save data.
Automatically saves and loads data on server start and stop.
-
Nested Class Summary
Nested classes/interfaces inherited from class dev.scsupercraft.mc.libraries.corelib.api.data.SaveData
SaveData.Type -
Constructor Summary
ConstructorsConstructorDescriptionWorldSaveData(Supplier<@NotNull T> defaultValue, CodecHolder<T> codecHolder, Function<net.minecraft.server.MinecraftServer, File> fileGetter, SaveData.Type type) Creates new synced world save data. -
Method Summary
-
Constructor Details
-
WorldSaveData
@AvailableSince("1.0.0") public WorldSaveData(Supplier<@NotNull T> defaultValue, CodecHolder<T> codecHolder, Function<net.minecraft.server.MinecraftServer, File> fileGetter, SaveData.Type type) Creates new synced world save data.- Parameters:
defaultValue- A supplier that returns the default value for this savable. Used if there isn't any existing data during loading.codecHolder- A codec holder for serializing the save data.fileGetter- A function that accepts the current server and returns the file that the data will be saved to.type- What should the data be saved as.
-
-
Method Details
-
isLoaded
public static boolean isLoaded()Has theWorldSaveDatabeen loaded.- Returns:
- Is it loaded?
-