Class TachyonProfileImpl
java.lang.Object
tech.skworks.tachyon.plugin.core.playerdata.TachyonProfileImpl
- All Implemented Interfaces:
TachyonProfile
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull List<ComponentNamespace> @NotNull Map<ComponentNamespace, org.bson.BsonDocument> <T extends Record>
TgetComponent(@NotNull Class<T> clazz) Retrieves a component by its class type.<T extends Record>
TgetComponent(@NotNull Class<T> clazz, T defaultValue) Retrieves a component by its class type, returning a fallback value if it is not found.getUuid()Gets the unique identifier of the player who owns this profile.boolean<T extends Record>
voidinitComponent(T component) voidmarkAsClean(@NotNull Collection<Class<? extends Record>> savedClasses, @NotNull Collection<ComponentNamespace> deletedNames) <T extends Record>
voidremoveComponent(@NotNull Class<T> clazz) <T extends Record>
voidsetComponent(T component) Overwrites the current instance of the component in the profile memory and marks it as dirty for the next profile save.<T extends Record>
voidupdateComponent(@NotNull Class<T> clazz, @NotNull UnaryOperator<T> modifier) Convenience method to safely update an existing Record component using its Builder.
-
Constructor Details
-
TachyonProfileImpl
-
-
Method Details
-
initComponent
-
setComponent
Description copied from interface:TachyonProfileOverwrites the current instance of the component in the profile memory and marks it as dirty for the next profile save.- Specified by:
setComponentin interfaceTachyonProfile- Type Parameters:
T- The specific type of the Protobuf message.- Parameters:
component- The new Protobuf component instance to store.
-
updateComponent
public <T extends Record> void updateComponent(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull UnaryOperator<T> modifier) Description copied from interface:TachyonProfileConvenience method to safely update an existing Record component using its Builder.This retrieves the current immutable Record component, applies the modification function replaces the stored component, and automatically mark it as dirty for the next save cycle, and increment its version counter.
- Specified by:
updateComponentin interfaceTachyonProfile- Type Parameters:
T- The specific record comportnent type- Parameters:
clazz- The class of the Record component to updatemodifier- A function taking the current Record instance and returning a new updated Record instance.
-
getComponent
Description copied from interface:TachyonProfileRetrieves a component by its class type, returning a fallback value if it is not found.- Specified by:
getComponentin interfaceTachyonProfile- Type Parameters:
T- The specific type of the Protobuf message.- Parameters:
clazz- The class of the component to retrieve.defaultValue- The value to return if the player does not have this component loaded.- Returns:
- The current component instance, or the provided default value.
-
getComponent
Description copied from interface:TachyonProfileRetrieves a component by its class type.- Specified by:
getComponentin interfaceTachyonProfile- Type Parameters:
T- The specific type of the Protobuf message.- Parameters:
clazz- The class of the component to retrieve.- Returns:
- The current component instance, or
nullif not found.
-
removeComponent
- Specified by:
removeComponentin interfaceTachyonProfile
-
hasPendingChanges
public boolean hasPendingChanges()- Specified by:
hasPendingChangesin interfaceTachyonProfile
-
extractDirtyComponents
- Specified by:
extractDirtyComponentsin interfaceTachyonProfile
-
extractDeletedComponents
- Specified by:
extractDeletedComponentsin interfaceTachyonProfile
-
markAsClean
public void markAsClean(@NotNull @NotNull Collection<Class<? extends Record>> savedClasses, @NotNull @NotNull Collection<ComponentNamespace> deletedNames) - Specified by:
markAsCleanin interfaceTachyonProfile
-
getUuid
Description copied from interface:TachyonProfileGets the unique identifier of the player who owns this profile.- Specified by:
getUuidin interfaceTachyonProfile- Returns:
- The player's UUID.
-