Skip to main content

âš–ī¸ Conditions

tip

Adding ! before a condition type inverts its logic. For instance:

type: "!permission"
permission: "craftengine.admin"

any_of​

Satisfy any one of the conditions.

type: any_of
terms:
- type: xxx
- type: xxx

all_of​

All conditions must be satisfied.

type: all_of
terms:
- type: xxx
- type: xxx

inverted​

Negate the result value of the current condition.

type: inverted
term:
type: xxx

falling_block​

Check whether the drop was caused by the block falling.

type: falling_block

survives_explosion​

Detect whether it is possible to survive the explosion.

type: survives_explosion

match_item​

Match the item in hand.

type: match_item
id: "minecraft:iron_pickaxe"
regex: false # whether to use regex matching
type: match_item
id:
- "minecraft:iron_pickaxe"
- "minecraft:stone_pickaxe"
regex: false # whether to use regex matching

match_block_property​

Match the block state property

type: match_block_property
properties:
age: 3

enchantment​

Detect the enchantments on the item in hand.

type: enchantment
predicate: minecraft:silk_touch>=1 # > >= = < <=

table_bonus​

Provide different success probabilities at various enchantment levels.

type: table_bonus
enchantment: minecraft:fortune
chances:
- 0.1
- 0.5
- 0.8
- 1

random​

type: random
value: 0.1 # 10%

permission​

Checks if the player has the permission

type: permission
permission: "craftengine.admin"

expression​

Checks if the expression returns true

type: expression
# https://ezylang.github.io/EvalEx/references/references.html
expression: "<papi:farming_level> >= 10"

string_equals​

Determines if the two values are equal

type: string_equals
value1: "<arg:player.name>"
value2: "Player_A"

string_contains​

Determines if value1 contains value2

type: string_contains
value1: "<arg:player.name>"
value2: "A"

string_regex​

Determines if value matches the pattern

type: string_regex
value: "<arg:player.name>"
regex: "[a-Z]"

is_null​

Checks if the argument is null

type: is_null
argument: "player.main_hand_item"

hand​

Checks the interaction hand

type: hand
hand: main_hand # off_hand

on_cooldown​

Checks if player is on cooldown (use set_cooldown function to set cooldown for player)

type: on_cooldown
id: my_cooldown_id
info

Example usage

events:
- on: right_click
functions:
- type: set_cooldown
id: test
time: 30s
- type: command
command: give <arg:player.name> minecraft:apple
conditions:
- type: "!on_cooldown"
id: test
info

More conditions are coming...