Class NPCMultiSelectCommandBase

Direct Known Subclasses:
NPCDebugCommand.ClearCommand, NPCDebugCommand.DefaultsCommand, NPCDebugCommand.SetCommand, NPCDebugCommand.ShowCommand, NPCDebugCommand.ToggleCommand

public abstract class NPCMultiSelectCommandBase extends NPCWorldCommandBase
A command base that runs directly on the thread of the target world and provides access to one or multiple NPC entities.

If an entity argument is provided, it will target that entity (must be an NPC). Otherwise, the sender must be a player or an error is sent.

If the sender is a player, the command will select one or multiple NPC entities close to the players camera position. A "range" option is provided to limit the search distance, and an "angle" option to specify a search view cone angle. Additionally, a "roles" option is provided to filter the NPCs by their role names. A "nearest" flag is also provided to only select the nearest NPC in the view cone.

An angle of 0 degrees does a ray test directly along the players view direction. An angle of 180 degrees selects a full sphere around the player. Any other angle between 0 and 180 degrees selects a view cone with the specified angle used as half-angle for the cone.

There are also presets to simplify common use cases:

  • "cone": View cone with a 30-degree angle, only nearest NPC
  • "coneAll": View cone with a 30-degree angle, all NPC in view cone
  • "sphere": Sphere, all NPCs in range
  • "ray": Ray test hit, only the nearest NPC

This command base ensures thread safety by executing on the world thread, and provides access to the NPC entity's NPCEntity, Store, Ref, and World.

  • Constructor Details

    • NPCMultiSelectCommandBase

      public NPCMultiSelectCommandBase(@Nonnull String name, @Nonnull String description)
      Default Constructor for an NPCMultiSelectCommandBase instance.
      Parameters:
      name - The name of the command.
      description - The description of the command.
    • NPCMultiSelectCommandBase

      public NPCMultiSelectCommandBase(@Nonnull String name, @Nonnull String description, boolean requiresConfirmation)
      Constructor for an NPCMultiSelectCommandBase instance.
      Parameters:
      name - The name of the command.
      description - The description of the command.
      requiresConfirmation - Whether the command requires additional confirmation.
    • NPCMultiSelectCommandBase

      public NPCMultiSelectCommandBase(@Nonnull String description)
      This constructor is specifically only for variant commands, added with AbstractCommand.addUsageVariant(AbstractCommand).
      Parameters:
      description - The description of the command.