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

public abstract class NpcAction extends Object
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.

  • Constructor Details

    • NpcAction

      public NpcAction(String name, boolean requiresValue)
  • 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

      public String getName()
    • requiresValue

      public boolean requiresValue()