- 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 Summary
Modifier and TypeMethodDescriptionReturns a defaultFunction
that throws anUnsupportedOperationException
when called.Gets the options available for this Interactableboolean
default boolean
Executes an action based on the given option.default boolean
interact
(String option, BiFunction<String, CharSequence, Boolean> spred) Executes the action based on the given option.default boolean
interact
(String option, BiFunction<String, CharSequence, Boolean> spred, Function<Integer, T> typeMapper) Executes an action based on the given option.boolean
Performs an action based on the given type.
-
Method Details
-
interact
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
-
getOptions
Gets the options available for this Interactable- Returns:
- a list of strings containing the options
-
interact
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
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 checkedspred
- a BiFunction that takes a String and a CharSequence and returns a booleantypeMapper
- a Function that takes an Integer and returns a generic type- Returns:
- a boolean indicating whether the action was successful
-
getDefaultMapper
Returns a defaultFunction
that throws anUnsupportedOperationException
when called.- Returns:
- a default
Function
-