Interface TachyonProfile
- All Known Implementing Classes:
GrpcTachyonProfile
public interface TachyonProfile
Project Tachyon
Class TachyonProfile
Component lifecycle:
-
setComponent()called by plugins — sets value AND marks dirty. -
saveComponent()marks dirty + immediately enqueues a gRPC save. -
saveProfile()flushes only dirty components to the backend.
The dirty set acts as a safety net: if a saveComponent() gRPC call hasn't
been confirmed yet when the player disconnects, saveProfile() will catch it.
- Since:
- 1.0.0-SNAPSHOT
- Version:
- 1.0
- Author:
- Jimmy (vSKAH) - 09/04/2026
-
Method Summary
Modifier and TypeMethodDescription<T extends tech.skworks.tachyon.libs.com.google.protobuf.Message>
CompletableFuture<Void> deleteComponent(T component) Resets or deletes a component from the profile and immediately enqueues an asynchronous delete operation to the backend via gRPC.<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.<T extends tech.skworks.tachyon.libs.com.google.protobuf.Message>
CompletableFuture<Void> saveComponent(T component) Marks the given component as dirty and immediately enqueues an asynchronous save operation to the backend via gRPC.Asynchronously flushes all components currently marked as "dirty" to the backend.<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.
-
Method Details
-
setComponent
<T extends tech.skworks.tachyon.libs.com.google.protobuf.Message> void setComponent(@NotNull T component) Overwrites the current instance of the component in the profile memory and marks it as dirty for the next profile save.- Type Parameters:
T- The specific type of the Protobuf message.- Parameters:
component- The new Protobuf component instance to store.
-
updateComponent
<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) Convenience 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
setComponent(Message)to mark it as dirty.- 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
<T extends tech.skworks.tachyon.libs.com.google.protobuf.Message> T getComponent(@NotNull @NotNull Class<T> clazz, @NotNull T defaultValue) Retrieves a component by its class type, returning a fallback value if it is not found.- 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
@Nullable <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message> T getComponent(@NotNull @NotNull Class<T> clazz) Retrieves a component by its class type.- 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 <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message> T getComponent(@NotNull @NotNull String componentShortName) Retrieves a component by its short name (e.g., "CookieComponent").- 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.
-
saveComponent
<T extends tech.skworks.tachyon.libs.com.google.protobuf.Message> CompletableFuture<Void> saveComponent(@NotNull T component) Marks the given component as dirty and immediately enqueues an asynchronous save operation to the backend via gRPC.- Type Parameters:
T- The specific type of the Protobuf message.- Parameters:
component- The component to save immediately.- Returns:
- A CompletableFuture that completes when the backend acknowledges the save.
-
deleteComponent
<T extends tech.skworks.tachyon.libs.com.google.protobuf.Message> CompletableFuture<Void> deleteComponent(@NotNull T component) Resets or deletes a component from the profile and immediately enqueues an asynchronous delete operation to the backend via gRPC.- Type Parameters:
T- The specific type of the Protobuf message.- Parameters:
component- The component to remove immediately.- Returns:
- A CompletableFuture that completes when the backend acknowledges the deletion.
-
saveProfile
CompletableFuture<Void> saveProfile()Asynchronously flushes all components currently marked as "dirty" to the backend.This is typically called during player disconnection or periodic auto-saves to ensure no data is lost.
- Returns:
- A CompletableFuture that completes when all dirty components are saved.
-
getUuid
UUID getUuid()Gets the unique identifier of the player who owns this profile.- Returns:
- The player's UUID.
-