Action On Sending Message (Power Type)

Runs an action when the holder sends a chat message, optionally only when it matches a pattern.

Runs an Entity Action when the holder sends a chat message — optionally only when the message matches a pattern. This is the typed “magic word” trigger.

Type ID: apoli:action_on_sending_message

Fields

FieldTypeDefaultPurpose
entity_actionEntity ActionoptionalRun on the holder when a matching message is sent.
message_typeIdentifieroptionalOnly react to messages of this chat type. Omit to react to all of them.
filterMessage FilteroptionalA single filter. Merged into filters.
filtersArray of Message Filter[]Filters tested in order against the message.
priorityInteger0Ordering when several powers want to handle the same message. Higher runs first.

With no filters at all, every message the holder sends triggers entity_action.

Message Filter

FieldTypeDefaultPurpose
filterStringrequiredA regular expression searched for in the message. If it isn’t valid regex it is matched literally.
before_actionEntity ActionoptionalRun before the power’s entity_action.
after_actionEntity ActionoptionalRun after the power’s entity_action.
preventBooleanfalseSwallow the message — it is not sent to chat — and stop testing later filters.

Examples

Say “fireball” in chat to launch one, and don’t broadcast the word:

{
  "type": "apoli:action_on_sending_message",
  "filter": { "filter": "(?i)fireball", "prevent": true },
  "entity_action": {
    "type": "apoli:fire_projectile",
    "entity_type": "minecraft:small_fireball",
    "speed": 1.5
  }
}

Two magic words, each with its own follow-up:

{
  "type": "apoli:action_on_sending_message",
  "filters": [
    {
      "filter": "(?i)heal",
      "prevent": true,
      "after_action": { "type": "apoli:heal", "amount": 6.0 }
    },
    {
      "filter": "(?i)burn",
      "prevent": true,
      "after_action": { "type": "apoli:set_on_fire", "duration": 60 }
    }
  ]
}