Class NpcAction
java.lang.Object
de.oliver.fancynpcs.api.actions.NpcAction
- Direct Known Subclasses:
BlockUntilDoneAction, ConsoleCommandAction, ExecuteRandomActionAction, MessageAction, NeedItemAction, NeedPermissionAction, PlayerCommandAction, PlayerCommandAsOpAction, PlaySoundAction, SendToServerAction, UnknownActionAction, WaitAction
The NpcAction class is an abstract class that represents an action that can be performed by an NPC.
Each NpcAction has a name and a flag indicating whether it requires a value.
The NpcAction class provides an abstract execute method that must be implemented by subclasses to specify the behavior of the action when executed.
Subclasses of NpcAction can provide additional data using the NpcActionData record, which includes an order value to specify the order of execution, the NpcAction itself, and a value associated with the action.
This class provides getters for the name and the requiresValue flag of the action.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidexecute(@NotNull ActionExecutionContext context, @Nullable String value) Executes the action associated with this NpcAction.getName()boolean
-
Constructor Details
-
NpcAction
-
-
Method Details
-
execute
public abstract void execute(@NotNull @NotNull ActionExecutionContext context, @Nullable @Nullable String value) Executes the action associated with this NpcAction.- Parameters:
context- The context in which the action is being executed.value- The value associated with the action. Can be null if no value is required.
-
getName
-
requiresValue
public boolean requiresValue()
-