Interface Interactable<T>

Type Parameters:
T - The type of action to be performed.
All Known Implementing Classes:
Component, GroundItem, LocalPlayer, Npc, PathingEntity, Player, SceneObject, World

public interface Interactable<T>
An interface that defines an action that can be performed.
  • Method Details

    • interact

      boolean interact(T type)
      Performs an action based on the given type.
      Parameters:
      type - The type of action to perform.
      Returns:
      true if the action was successful, false otherwise.
    • interact

      boolean interact(Integer option)
    • getOptions

      @NotNull @NotNull List<String> getOptions()
      Gets the options available for this Interactable
      Returns:
      a list of strings containing the options
    • interact

      default boolean interact(String option)
      Executes an action based on the given option.
      Parameters:
      option - The option to execute the action for.
      Returns:
      True if the action was successful, false otherwise.
    • interact

      default boolean interact(String option, BiFunction<String,CharSequence,Boolean> spred)
      Executes the action based on the given option.
      Parameters:
      option - The option to execute the action for.
      spred - The function to execute the action.
      Returns:
      True if the action was successful, false otherwise.
    • interact

      default boolean interact(String option, BiFunction<String,CharSequence,Boolean> spred, Function<Integer,T> typeMapper)
      Executes an action based on the given option.
      Parameters:
      option - the option to be checked
      spred - a BiFunction that takes a String and a CharSequence and returns a boolean
      typeMapper - a Function that takes an Integer and returns a generic type
      Returns:
      a boolean indicating whether the action was successful
    • getDefaultMapper

      default Function<Integer,T> getDefaultMapper()
      Returns a default Function that throws an UnsupportedOperationException when called.
      Returns:
      a default Function