Composition Cookbook

Last updated Nov 6, 2026

Composition Cookbook

Recipes that stay in When → Only if → Do using composition (items, cancel, audiences, chaining). Not a fourth DSL.

Seeded showcases that use these ideas: blaze_blade, help_desk, last_stand, golden_meal, enchant_casino. Full list: Examples.


1) Named-sword hit bonus

Rename a diamond sword so the name contains Blaze (anvil), or give a tagged sword with give_named.

id: blaze_blade
type: automation
enabled: true
when:
  type: player_damage
  item:
    material: DIAMOND_SWORD
    name_contains: Blaze
only_if:
  - chance: 25
do:
  - damage: { amount: 2, target: victim }
  - particle: { particle: FLAME, count: 18 }
  - action_bar: "<gold>Blaze Blade scorches!"

In the picker: hold the sword → Shift-click an item-aware When/Only-if to fill matcher fields (material, tag, name).


2) Spawn cancel break (rules engine)

id: spawn_protect_break
type: automation
enabled: true
when:
  type: block_break
only_if:
  - region: spawn
    fail_message: "<red>No breaking in spawn."
    fail_cancel: true
do:
  - cancel_event: {}

cancel_event needs a cancellable Bukkit When (break/place/interact/command…). Fail feedback uses fail_message / fail_cancel / fail_do on Only-if leaves. Set region to your real WorldGuard region id.


3) Arena auto-start (region_threshold)

id: arena_auto_start
type: automation
enabled: true
when:
  type: region_threshold
  region: arena
  amount: ">= 4"
only_if:
  - players_in_region: { region: arena, amount: ">= 4" }
do:
  - call_event: { event: arena_match, vars: { round: 1 } }
  - broadcast: "<green>Arena match starting!"

Use your WorldGuard region ids. Create arena_match as a separate event.


4) Around-players shockwave

do:
  - around_players:
      radius: 8
      include_self: false
      do:
        - damage: { amount: 2 }
        - particle: { particle: EXPLOSION, count: 4 }
  - to_victim:
      do:
        - effect: { effect: slowness, duration: 2s, amplifier: 1 }

Optional meta on any Do: chance, cooldown, delay (ticks), require (soft placeholder gate).


5) VIP gate + PlaceholderAPI

only_if:
  - permission: event.vip
    fail_message: "<red>VIP only"
    fail_do:
      - sound: { sound: BLOCK_NOTE_BLOCK_BASS }
  - placeholder_match: { left: "%vault_eco_balance%", op: ">=", right: "1000" }

6) Join gate + elytra glide race

Require gear on the clickable join, stash, equip a race kit, then count only gliding distance.

- join_prompt:
    message: "<aqua>Sky Dash: "
    button: "[Join]"
    lasts: 75s
    join_only_if:
      - any:
          fail_message: "<red>Wear or carry an elytra to join."
          children:
            - wearing: { item: ELYTRA }
            - has_item: { item: ELYTRA, amount: 1 }
# later launch step:
- stash_inventory: { target: participants }
- give: { item: ELYTRA, slot: chest, target: participants }
# race goal:
goal:
  travel_distance: { amount: 250, scope: player, mode: gliding }

Modes: any, flying, gliding, ground. Build an elytra race with travel_distance mode gliding and a join prompt.


7) Zoned crop meter

Anchor the contest where staff start the event, then only count growth inside the radius.

do:
  - save_location: { id: meter, shared: true }
  - region_border_particle: { radius: 24, points: 32, particle: HAPPY_VILLAGER }
goal:
  crop_grow_count: { amount: 25, radius: 24, center_id: meter }

Optional region: your_wg_id instead of (or with) radius. Build this into your own event; no stock showcase ships with a crop meter.


See also

Still stuck? Ask about this page