Action on chat
origins-powerful-powers:action_on_chatpower type
Runs actions when a chat message contains certain text. It can react to messages the holder sends (spoken spells, trigger words), messages the holder receives from other players, or both.
| Field | Type | Default | Description |
|---|---|---|---|
substrings | Array of Strings | required | The text to look for. Each one can be anywhere in the message. |
match | String | "any" | any: one substring is enough. all: every substring must be in the message. |
ordered | Boolean | false | With match: all: the substrings must appear in the order listed, without overlapping. |
case_sensitive | Boolean | true | When false, matching ignores case. |
direction | String | "both" | outgoing: messages the holder sends. incoming: messages other players send while the holder is online. both: either. |
hide_message | Boolean | false | Hides a matching outgoing message from chat. |
entity_action | Entity action | optional | Runs on the holder, once per matching message. |
bientity_action | Bi-entity action | optional | Actor: the holder. Target: for an outgoing message, each other online player (once each). For an incoming one, the sender. |
bientity_condition | Bi-entity condition | optional | Filters bientity_action per target, with the same actor and target. entity_action ignores it. |
It also accepts Origins' usual condition. The power ignores chat while it's false.
- Only chat messages count.
/say,/me,/msg,/telland command blocks are ignored. - The text is what the player typed, before server formatting.
- Several powers can match the same message, and they all run. If any matching outgoing power hides the message, it's hidden.
- A hidden message runs no incoming powers.
- Your own message is only outgoing for you, so
direction: bothruns once per message. - "Incoming" means any other player's chat message, from anywhere in the world.
Example: "Word of fire". Saying "ignis" (in any capitalisation) sets every player within 10 blocks on fire. The word is hidden from chat.
{
"type": "origins-powerful-powers:action_on_chat",
"substrings": [
"ignis"
],
"case_sensitive": false,
"direction": "outgoing",
"hide_message": true,
"bientity_condition": {
"type": "origins:distance",
"comparison": "<=",
"compare_to": 10
},
"bientity_action": {
"type": "origins:target_action",
"action": {
"type": "origins:set_on_fire",
"duration": 5
}
}
}Example: "Eavesdropper". When anyone says both "where" and "base", in that order, you get a glowing hint on them.
{
"type": "origins-powerful-powers:action_on_chat",
"substrings": [
"where",
"base"
],
"match": "all",
"ordered": true,
"case_sensitive": false,
"direction": "incoming",
"bientity_action": {
"type": "origins:target_action",
"action": {
"type": "origins:apply_effect",
"effect": {
"effect": "minecraft:glowing",
"duration": 200
}
}
}
}