Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Conditional: Has Items

ricochet1k edited this page Apr 15, 2012 · 1 revision

Syntax: {entity}.has([all]items|item).{itemalias}

Description: Returns true if the referred entity is a player and has the listed items in inventory. There are two modes for this conditional statement:

  • has[all]items: Returns true if and only if all the Item values specified are in the player's inventory.

  • hasitem: Returns true if the player's inventory matches at least one of the Items in the alias.

Example:

Aliases:
    Item:
        oneofEachSword:
            - 'IRON_SWORD'
            - 'WOOD_SWORD'
            - 'STONE_SWORD'
            - 'GOLD_SWORD'
            - 'DIAMOND_SWORD'
Damage:
    - 'switch.attacker': # Used so we can have exclusive branching, and only one message is shown.
        - 'hasitems._oneofEachSword':
            - 'message.attacker': "You've got one of every sword in Minecraft!"
        - 'hasitem._oneofEachSword':
            - 'message.attacker': "You've got at least one sword in your inventory!"
Clone this wiki locally