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<tech.skworks.tachyon.libs.com.google.protobuf.Message> <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message>
TgetComponent(@NotNull Class<T> clazz) Retrieves a component by its class type.<T extends tech.skworks.tachyon.libs.com.google.protobuf.Message>
TgetComponent(@NotNull Class<T> clazz, T defaultValue) Retrieves a component by its class type, returning a fallback value if it is not found.<T extends tech.skworks.tachyon.libs.com.google.protobuf.Message>
TgetComponent(@NotNull String componentShortName) Retrieves a component by its short name (e.g., "CookieComponent").getUuid()Gets the unique identifier of the player who owns this profile.boolean<T extends tech.skworks.tachyon.libs.com.google.protobuf.Message>
voidinitComponent(T component) voidmarkAsClean(@NotNull Collection<Class<? extends tech.skworks.tachyon.libs.com.google.protobuf.Message>> savedClasses, @NotNull Collection<String> deletedComponent) <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message>
voidremoveComponent(T componentDefaultInstance) <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message>
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 tech.skworks.tachyon.libs.com.google.protobuf.Message, B extends tech.skworks.tachyon.libs.com.google.protobuf.Message.Builder>
voidupdateComponent(@NotNull Class<T> clazz, @NotNull Consumer<B> modifier) Convenience method to safely update an existing component using its Builder.
-
Constructor Details
-
TachyonProfileImpl
-
-
Method Details
-
initComponent
public <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message> void initComponent(@NotNull T component) -
setComponent
public <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message> void setComponent(@NotNull T component) 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 tech.skworks.tachyon.libs.com.google.protobuf.Message, B extends tech.skworks.tachyon.libs.com.google.protobuf.Message.Builder> void updateComponent(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull Consumer<B> modifier) Description copied from interface:TachyonProfileConvenience method to safely update an existing component using its Builder.This retrieves the current component, converts it to a Builder, applies your modifications, rebuilds it, and automatically calls
TachyonProfile.setComponent(Message)to mark it as dirty.- Specified by:
updateComponentin interfaceTachyonProfile- Type Parameters:
T- The specific type of the Protobuf message.B- The specific type of the Protobuf message's Builder.- Parameters:
clazz- The class of the component to update.modifier- A consumer applying the changes to the component's builder.
-
getComponent
@Nullable public <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message> T getComponent(@NotNull @NotNull Class<T> clazz) 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.
-
getComponent
@Nullable public <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message> T getComponent(@NotNull @NotNull String componentShortName) Description copied from interface:TachyonProfileRetrieves a component by its short name (e.g., "CookieComponent").- Specified by:
getComponentin interfaceTachyonProfile- Type Parameters:
T- The specific type of the Protobuf message.- Parameters:
componentShortName- The exact short name of the Protobuf descriptor.- Returns:
- The current component instance, or
nullif not found.
-
getComponent
public <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message> T getComponent(@NotNull @NotNull Class<T> clazz, @NotNull T defaultValue) 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.
-
removeComponent
public <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message> void removeComponent(@NotNull T componentDefaultInstance) - Specified by:
removeComponentin interfaceTachyonProfile
-
hasPendingChanges
public boolean hasPendingChanges()- Specified by:
hasPendingChangesin interfaceTachyonProfile
-
extractDirtyComponents
@NotNull public @NotNull List<tech.skworks.tachyon.libs.com.google.protobuf.Message> extractDirtyComponents()- Specified by:
extractDirtyComponentsin interfaceTachyonProfile
-
extractDeletedComponentsUrls
- Specified by:
extractDeletedComponentsUrlsin interfaceTachyonProfile
-
markAsClean
public void markAsClean(@NotNull @NotNull Collection<Class<? extends tech.skworks.tachyon.libs.com.google.protobuf.Message>> savedClasses, @NotNull @NotNull Collection<String> deletedComponent) - 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.
-