Has Command Tag (Entity Condition Type)

Passes when the entity carries one of the given /tag command tags.

Passes when the entity carries one of the given command tags — the ones set with vanilla’s /tag <target> add <name>. This is the simplest way to let a command or a function flip a power on without inventing a resource for it.

Type ID: apoli:has_command_tag

Fields

FieldTypeDefaultDescription
command_tagStringoptionalA single tag to look for.
command_tagsarray of String[]Several tags. Passes if the entity has any of them. Combines with command_tag.

With neither field set, it passes whenever the entity has any command tag at all.

Example

Grant flight only while a tag is present, so a command can toggle it:

{
  "type": "apoli:creative_flight",
  "condition": {
    "type": "apoli:has_command_tag",
    "command_tag": "mypack.flying"
  }
}
tag @s add mypack.flying
tag @s remove mypack.flying

Several tags, any of which counts:

{
  "type": "apoli:has_command_tag",
  "command_tags": ["mypack.vip", "mypack.staff"]
}