Skip to content

Trigger Hands-On Examples

Belongs to: Action System · Related: Trigger Atom Reference · Handlers

The Trigger Atom Reference lists every atom; this page gives one minimal, ready-to-run YAML per trigger category—just copy and go. Every example shows only the actions block; merge it into your item definition (note that actions is at the same level as material).

General reminder: after editing actions, run /qi reload to apply them; right_click does not always fire against air, so for general-purpose cases prefer left_click.


Click Category

left_click —— most universal

yaml
actions:
  triggers:
    left_click:
      trigger:
        atom: left_click
      cooldown: 1s
      refs:
        - handler: qi:action_bar
          payload: "<gold>Swing!</gold>"

right_click

yaml
actions:
  triggers:
    right_click:
      trigger:
        atom: right_click
      refs:
        - handler: qi:message
          payload: "Right-click used"

shift_left_click (sneak + left-click)

yaml
actions:
  triggers:
    shift_left_click:
      trigger:
        atom: shift_left_click
      cooldown: 3s
      refs:
        - handler: qi:title
          payload: "<red>Charged Slash</red>||<gray>Sneak Heavy Strike</gray>||3||30||10"

Sneak / Movement Category

double_shift_toggle (double-tap sneak)

yaml
actions:
  triggers:
    dash:
      trigger:
        atom: double_shift_toggle
      cooldown: 3s
      refs:
        - handler: qi:command
          payload: "effect give {player} minecraft:speed 3 2"
        - handler: qi:sound
          payload: "minecraft:entity.player.attack.sweep;1;1.4"

sprint_start (begin sprinting)

yaml
actions:
  triggers:
    sprint_start:
      trigger:
        atom: sprint_start
      refs:
        - handler: qi:action_bar
          payload: "<aqua>Sprinting…</aqua>"

glide (elytra glide)

yaml
actions:
  triggers:
    glide:
      trigger:
        atom: glide
      refs:
        - handler: qi:command
          payload: "effect give {player} minecraft:slow_falling 5 0"

Item Management Category

equip / unequip

yaml
actions:
  triggers:
    equip:
      trigger:
        atom: equip
      refs:
        - handler: qi:action_bar
          payload: "<gold>✦ Guardian's Power Activated ✦</gold>"
        - handler: qi:sound
          payload: "minecraft:item.armor.equip_gold;1;1.2"
    unequip:
      trigger:
        atom: unequip
      refs:
        - handler: qi:action_bar
          payload: "<gray>Guardian's Power fades…</gray>"

consume (eat / drink, requires an edible material)

yaml
actions:
  triggers:
    consume:
      trigger:
        atom: consume
      cooldown: 30s
      refs:
        - handler: qi:command
          payload: "effect give {player} minecraft:strength 20 1"

drop

yaml
actions:
  triggers:
    drop:
      trigger:
        atom: drop
      refs:
        - handler: qi:message
          payload: "You dropped it"

Block / Shooting Category

break_block

yaml
actions:
  triggers:
    break_block:
      trigger:
        atom: break_block
      refs:
        - handler: qi:sound
          payload: "minecraft:block.stone.break;1;1"

bow_shoot

yaml
actions:
  triggers:
    bow_shoot:
      trigger:
        atom: bow_shoot
      cooldown: 2s
      refs:
        - handler: qi:action_bar
          payload: "<gold>Charged Shot!</gold>"

fish

yaml
actions:
  triggers:
    fish:
      trigger:
        atom: fish
      refs:
        - handler: qi:message
          payload: "Got a bite!"

Combat Category

on_hit (take damage)

yaml
actions:
  triggers:
    on_hit:
      trigger:
        atom: on_hit
      cooldown: 3s
      refs:
        - handler: qi:title
          payload: "<red>Counterattack!</red>||<dark_red>+10 Defense</dark_red>||5||20||5"

on_damage (deal damage)

yaml
actions:
  triggers:
    on_damage:
      trigger:
        atom: on_damage
      cooldown: 1s
      refs:
        - handler: combat:swing
          payload: "heavy"

on_kill (kill an entity)

yaml
actions:
  triggers:
    on_kill:
      trigger:
        atom: on_kill
      refs:
        - handler: qi:command
          payload: "effect give {player} minecraft:regeneration 3 1"
        - handler: qi:action_bar
          payload: "<green>Kill Heal</green>"

critical_hit

yaml
actions:
  triggers:
    critical_hit:
      trigger:
        atom: critical_hit
      refs:
        - handler: qi:sound
          payload: "minecraft:entity.player.attack.crit;1;1.2"

Entity Interaction Category

interact_entity (right-click a creature)

yaml
actions:
  triggers:
    interact_entity:
      trigger:
        atom: interact_entity
      refs:
        - handler: qi:message
          payload: "You interacted with a creature"

vehicle_enter (enter a vehicle)

yaml
actions:
  triggers:
    vehicle_enter:
      trigger:
        atom: vehicle_enter
      refs:
        - handler: qi:action_bar
          payload: "<aqua>Departing!</aqua>"

Environment / Server Category

join (join the server)

yaml
actions:
  triggers:
    join:
      trigger:
        atom: join
      refs:
        - handler: qi:title
          payload: "<gold>Welcome back</gold>||<gray>{player}</gray>||10||40||10"

world_change (switch dimension / world)

yaml
actions:
  triggers:
    world_change:
      trigger:
        atom: world_change
      refs:
        - handler: qi:message
          payload: "You have arrived in a new world"

Periodic Trigger: tick

yaml
actions:
  triggers:
    regen_aura:
      trigger:
        atom: tick
      tick: 40                  # every 40 ticks (2 seconds)
      refs:
        - handler: qi:command
          payload: "effect give {player} minecraft:regeneration 2 0"

Sequence Combo: sequence

yaml
actions:
  triggers:
    whirlwind:
      trigger:
        sequence:
          - sneak_down
          - left_click
          - left_click
        window: 500             # window between steps (milliseconds)
      cooldown: 5s
      consume:
        - "level:2"
      refs:
        - handler: qi:message
          payload: "<gold>Whirlwind Slash!</gold>"
        - handler: qinhskills:cast
          payload: '{"skill":"whirlwind_slash","level":1}'

Combination: condition + cost + cooldown

yaml
actions:
  triggers:
    power_strike:
      trigger:
        atom: on_hit
      cooldown: 3s
      conditions:
        - "player_level:>=15"
        - "player_sneaking:true"
      consume:
        - "item:redstone:1"
      refs:
        - handler: qi:title
          payload: "<red>Power Strike</red>||||5||20||5"
        - handler: combat:swing
          payload: "heavy"

For condition / cost / cooldown syntax, see Cooldown / Cost / Condition.


Next Steps