Class AbstractTargetEntityCommand

Direct Known Subclasses:
EntityEffectCommand, EntityHideFromAdventurePlayersCommand, EntityIntangibleCommand, EntityInvulnerableCommand, EntityMakeInteractableCommand, EntityStatsAddCommand, EntityStatsDumpCommand, EntityStatsGetCommand, EntityStatsResetCommand, EntityStatsSetCommand, EntityStatsSetToMaxCommand

public abstract class AbstractTargetEntityCommand extends AbstractAsyncCommand
A command base that runs directly on the thread of the target world. Allows for optional entity, player, and radius arguments.

The command will target entities based on the following priority:

  1. If a radius argument is provided, it will target all living entities within that radius from the sender's position (sender must be a player)
  2. If a player argument is provided, it will target that player's entity
  3. If an entity argument is provided, it will target that entity
  4. If the sender is a player, it will target the entity in view (ray-cast)
  5. Otherwise, an error message is sent

This command base ensures thread safety by executing on the world thread, and provides access to the target entities' Store, Ref list, and World.

  • Constructor Details

    • AbstractTargetEntityCommand

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

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

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