Interface TachyonProfile

All Known Implementing Classes:
TachyonProfileImpl

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 Details

    • setComponent

      <T extends Record> 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 Record> void updateComponent(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull UnaryOperator<T> modifier)
      Convenience 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.

      Type Parameters:
      T - The specific record comportnent type
      Parameters:
      clazz - The class of the Record component to update
      modifier - A function taking the current Record instance and returning a new updated Record instance.
    • getComponent

      <T extends Record> 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 Record> 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 null if not found.
    • removeComponent

      <T extends Record> void removeComponent(@NotNull @NotNull Class<T> clazz)
    • hasPendingChanges

      boolean hasPendingChanges()
    • extractDirtyComponents

      @NotNull @NotNull Map<ComponentNamespace, org.bson.BsonDocument> extractDirtyComponents()
    • extractDeletedComponents

      @NotNull @NotNull List<ComponentNamespace> extractDeletedComponents()
    • markAsClean

      void markAsClean(@NotNull @NotNull Collection<Class<? extends Record>> savedClasses, @NotNull @NotNull Collection<ComponentNamespace> deletedComponent)
    • getUuid

      UUID getUuid()
      Gets the unique identifier of the player who owns this profile.
      Returns:
      The player's UUID.