Class TrackerAnimation.Builder<T extends Tracker>

java.lang.Object
kr.toxicity.model.api.tracker.TrackerAnimation.Builder<T>
Type Parameters:
T - the type of tracker
Enclosing class:
TrackerAnimation<T extends Tracker>

public static final class TrackerAnimation.Builder<T extends Tracker> extends Object
A builder class for creating instances of TrackerAnimation.
Since:
2.2.0
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • type

      public <R extends T> TrackerAnimation.Builder<R> type(@NotNull @NotNull Class<R> newTargetClass)
      Changes the target tracker type for this builder.
      Type Parameters:
      R - the new tracker type
      Parameters:
      newTargetClass - the new target class
      Returns:
      a new builder for the specified type
      Since:
      2.2.0
    • priority

      @NotNull public @NotNull TrackerAnimation.Builder<T> priority(int priority)
      Sets the priority of the animation.
      Parameters:
      priority - the priority
      Returns:
      this builder
      Since:
      2.2.0
    • check

      @NotNull public @NotNull TrackerAnimation.Builder<T> check(@NotNull @NotNull Predicate<? super T> applyCondition)
      Sets the condition that must be met for the animation to play.
      Parameters:
      applyCondition - the condition predicate
      Returns:
      this builder
      Since:
      2.2.0
    • modifier

      @NotNull public @NotNull TrackerAnimation.Builder<T> modifier(@NotNull @NotNull Function<? super T,AnimationModifier> modifierBuilder)
      Sets the modifier builder for the animation.
      Parameters:
      modifierBuilder - a function that provides an AnimationModifier
      Returns:
      this builder
      Since:
      2.2.0
    • onRemove

      @NotNull public @NotNull TrackerAnimation.Builder<T> onRemove(@NotNull @NotNull Consumer<? super T> removeTask)
      Sets the task to run when the animation is removed.
      Parameters:
      removeTask - the removal task
      Returns:
      this builder
      Since:
      2.2.0
    • onSuccess

      @NotNull public @NotNull TrackerAnimation.Builder<T> onSuccess(@NotNull @NotNull Consumer<? super T> successTask)
      Sets the task to run when the animation starts successfully.
      Parameters:
      successTask - the success task
      Returns:
      this builder
      Since:
      2.2.0
    • onFallback

      @NotNull public @NotNull TrackerAnimation.Builder<T> onFallback(@NotNull @NotNull Consumer<? super T> fallbackTask)
      Sets the task to run when the animation fails to start.
      Parameters:
      fallbackTask - the fallback task
      Returns:
      this builder
      Since:
      2.2.0
    • build

      @NotNull public @NotNull TrackerAnimation<T> build()
      Builds the TrackerAnimation instance.
      Returns:
      the constructed animation
      Since:
      2.2.0