Skip to main content

Item Mechanics

Custom items defined in the plugins/zMenu/items/ folder can be given mechanics — reusable behaviours that run when a player interacts with the item. Each item is identified by an id (its YAML key), which zMenu stores on the item so the mechanic can recognise it later.

Item File Structure

# plugins/zMenu/items/default-items.yml
<item-id>:
name: "&aMy Item" # standard zMenu item format (see Item Configuration)
lore:
- "&7A special item"
mechanics:
<mechanic-id>:
# options depend on the mechanic

on-click

The on-click mechanic runs zMenu actions when the player left- or right-clicks while holding the item in their main hand.

magic-wand:
name: "&dMagic Wand"
material: BLAZE_ROD
mechanics:
on-click:
cooldown: 3
cancel-event: true
click-target: both
click-types:
- RIGHT
- SHIFT_RIGHT
click-requirements:
1:
requirements:
- type: permission
permission: "server.wand"
deny:
- type: message
messages:
- "&cYou can't use this wand."
actions:
- type: message
messages:
- "&dPoof! ✨"
- type: player-command
commands:
- "spawn"

Options

OptionTypeDefaultDescription
cooldownInteger0Seconds between activations, per player (0 = no cooldown)
cancel-eventBooleanfalseCancel the interaction (e.g. to stop block placement / item use)
click-targetStringbothWhere the click must happen: air, block, or both
click-typesListWhich clicks trigger it: LEFT, RIGHT, SHIFT_LEFT, SHIFT_RIGHT (sneaking uses the SHIFT variants)
click-requirementsSectionStandard zMenu requirements checked on click
actionsListStandard zMenu actions run on click
info

on-click fires from a PlayerInteractEvent on the main-hand item. Because no inventory is open, inventory-specific placeholders are not available inside the requirements/actions.

Next Steps

Copyright © 2026 GroupeZ|Build #loading...|-