Record Class TrackerAnimation<T extends Tracker>

java.lang.Object
java.lang.Record
kr.toxicity.model.api.tracker.TrackerAnimation<T>
Type Parameters:
T - the type of tracker this animation applies to
Record Components:
name - the unique name of the animation
priority - the priority of the animation (higher values usually take precedence)
targetClass - the class type of the tracker
applyCondition - a condition to check if the animation can be played
modifierBuilder - a function that provides an AnimationModifier
removeTask - the task to run when the animation is removed
successTask - the task to run when the animation starts successfully
fallbackTask - the task to run when the animation fails to start
All Implemented Interfaces:
Comparable<TrackerAnimation<T>>

public record TrackerAnimation<T extends Tracker>(@NotNull String name, int priority, @NotNull Class<T extends Tracker> targetClass, @NotNull Predicate<? super T extends Tracker> applyCondition, @NotNull Function<? super T extends Tracker, AnimationModifier> modifierBuilder, @NotNull Consumer<? super T extends Tracker> removeTask, @NotNull Consumer<? super T extends Tracker> successTask, @NotNull Consumer<? super T extends Tracker> fallbackTask) extends Record implements Comparable<TrackerAnimation<T>>
A record representing an animation configuration for a Tracker.

This class defines how an animation should be applied, its priority, and the tasks to run during different lifecycle stages of the animation.

Since:
2.2.0
  • Constructor Details

    • TrackerAnimation

      @Internal public TrackerAnimation(@NotNull @NotNull String name, int priority, @NotNull @NotNull Class<T> targetClass, @NotNull @NotNull Predicate<? super T> applyCondition, @NotNull @NotNull Function<? super T, AnimationModifier> modifierBuilder, @NotNull @NotNull Consumer<? super T> removeTask, @NotNull @NotNull Consumer<? super T> successTask, @NotNull @NotNull Consumer<? super T> fallbackTask)
      Creates an instance of a TrackerAnimation record class.
      Parameters:
      name - the value for the name record component
      priority - the value for the priority record component
      targetClass - the value for the targetClass record component
      applyCondition - the value for the applyCondition record component
      modifierBuilder - the value for the modifierBuilder record component
      removeTask - the value for the removeTask record component
      successTask - the value for the successTask record component
      fallbackTask - the value for the fallbackTask record component
  • Method Details

    • builder

      @NotNull public static @NotNull TrackerAnimation.Builder<Tracker> builder(@NotNull @NotNull String name)
      Creates a new builder for a TrackerAnimation.
      Parameters:
      name - the name of the animation
      Returns:
      a new builder instance
      Since:
      2.2.0
    • compareTo

      public int compareTo(@NonNull TrackerAnimation<T> o)
      Specified by:
      compareTo in interface Comparable<T extends Tracker>
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      @NotNull public @NotNull String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • priority

      public int priority()
      Returns the value of the priority record component.
      Returns:
      the value of the priority record component
    • targetClass

      @NotNull public @NotNull Class<T> targetClass()
      Returns the value of the targetClass record component.
      Returns:
      the value of the targetClass record component
    • applyCondition

      @NotNull public @NotNull Predicate<? super T> applyCondition()
      Returns the value of the applyCondition record component.
      Returns:
      the value of the applyCondition record component
    • modifierBuilder

      @NotNull public @NotNull Function<? super T, AnimationModifier> modifierBuilder()
      Returns the value of the modifierBuilder record component.
      Returns:
      the value of the modifierBuilder record component
    • removeTask

      @NotNull public @NotNull Consumer<? super T> removeTask()
      Returns the value of the removeTask record component.
      Returns:
      the value of the removeTask record component
    • successTask

      @NotNull public @NotNull Consumer<? super T> successTask()
      Returns the value of the successTask record component.
      Returns:
      the value of the successTask record component
    • fallbackTask

      @NotNull public @NotNull Consumer<? super T> fallbackTask()
      Returns the value of the fallbackTask record component.
      Returns:
      the value of the fallbackTask record component