Class TachyonProfileImpl

java.lang.Object
tech.skworks.tachyon.plugin.core.playerdata.TachyonProfileImpl
All Implemented Interfaces:
TachyonProfile

public class TachyonProfileImpl extends Object implements TachyonProfile
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull List<String>
     
    @NotNull List<tech.skworks.tachyon.libs.com.google.protobuf.Message>
     
    <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message>
    T
    getComponent(@NotNull Class<T> clazz)
    Retrieves a component by its class type.
    <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message>
    T
    getComponent(@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>
    T
    getComponent(@NotNull String componentShortName)
    Retrieves a component by its short name (e.g., "CookieComponent").
    Gets the unique identifier of the player who owns this profile.
    boolean
     
    <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message>
    void
    initComponent(T component)
     
    void
    markAsClean(@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>
    void
    removeComponent(T componentDefaultInstance)
     
    <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message>
    void
    setComponent(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>
    void
    updateComponent(@NotNull Class<T> clazz, @NotNull Consumer<B> modifier)
    Convenience method to safely update an existing component using its Builder.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TachyonProfileImpl

      public TachyonProfileImpl(UUID uuid)
  • 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: TachyonProfile
      Overwrites the current instance of the component in the profile memory and marks it as dirty for the next profile save.
      Specified by:
      setComponent in interface TachyonProfile
      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: TachyonProfile
      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 TachyonProfile.setComponent(Message) to mark it as dirty.

      Specified by:
      updateComponent in interface TachyonProfile
      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: TachyonProfile
      Retrieves a component by its class type.
      Specified by:
      getComponent in interface TachyonProfile
      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.
    • getComponent

      @Nullable public <T extends tech.skworks.tachyon.libs.com.google.protobuf.Message> T getComponent(@NotNull @NotNull String componentShortName)
      Description copied from interface: TachyonProfile
      Retrieves a component by its short name (e.g., "CookieComponent").
      Specified by:
      getComponent in interface TachyonProfile
      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 null if 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: TachyonProfile
      Retrieves a component by its class type, returning a fallback value if it is not found.
      Specified by:
      getComponent in interface TachyonProfile
      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:
      removeComponent in interface TachyonProfile
    • hasPendingChanges

      public boolean hasPendingChanges()
      Specified by:
      hasPendingChanges in interface TachyonProfile
    • extractDirtyComponents

      @NotNull public @NotNull List<tech.skworks.tachyon.libs.com.google.protobuf.Message> extractDirtyComponents()
      Specified by:
      extractDirtyComponents in interface TachyonProfile
    • extractDeletedComponentsUrls

      @NotNull public @NotNull List<String> extractDeletedComponentsUrls()
      Specified by:
      extractDeletedComponentsUrls in interface TachyonProfile
    • 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:
      markAsClean in interface TachyonProfile
    • getUuid

      public UUID getUuid()
      Description copied from interface: TachyonProfile
      Gets the unique identifier of the player who owns this profile.
      Specified by:
      getUuid in interface TachyonProfile
      Returns:
      The player's UUID.