βœ…Conditions

🎨 CREATING GUIS

Conditions

Control item visibility and click event execution


Conditions control whether an item is shown to a player and whether click events are allowed to execute. If a condition fails, the item is hidden (or replaced by a nested fallback item), and the conditionFailMessage is shown.

πŸ“ Condition Structure

Conditions are defined inside an item's conditions map:

conditions:
  has-permission:
    permission: admin.panel
  has-money:
    required-balance: 1000
conditionFailMessage: &cYou don't meet the requirements!

Common Properties

Every condition supports:

Property
Type
Description

inverted

Boolean

When true, the condition result is negated (passes when it would normally fail)

βœ… All Condition Types

Has Money

ID: has-money

Checks if the player has at least the specified balance. Requires Vault.

The required-balance field supports PlaceholderAPI placeholders.


Has Permission

ID: has-permission

Checks if the player has a specific permission node.

To check if a player does not have a permission:


Empty Slots

ID: has-empty-slots

Checks if the player's inventory has a minimum number of empty slots.

The YAML field is free-slots (not slots).


Integer Validation

ID: is-integer

Validates that a value is a valid integer. Useful for validating chat fetcher input to ensure the player typed a whole number.

Note: This condition only checks if the value can be parsed as an integer. It does not support comparison operators.


Double Validation

ID: is-double

Validates that a value is a valid decimal number. Useful for validating chat fetcher input that should accept decimals.

Note: This condition only checks if the value can be parsed as a decimal number. It does not support comparison operators. Use conditional-placeholder for numeric comparisons.


Conditional Placeholder

ID: conditional-placeholder

Compares two values using PlaceholderAPI placeholders. This is the most versatile condition type and the one to use for numeric comparisons.

Operators:

Operator
Description

=

String equals (exact match)

!=

String not equals

<

Numeric less than

>

Numeric greater than

<=

Numeric less than or equal

>=

Numeric greater than or equal

(=)

String contains check

(!=)

String not-contains check

The = and != operators perform string comparison, not numeric. For numeric equality, use >= and <= together. The (=) operator checks if the left side contains the right side; (!=) checks that it does not contain it.

The YAML field is conditional_condition (not condition):

Example checking if the player can afford a withdrawal:


Cooldown

ID: cooldown

Enforces a time-based cooldown before the condition passes again.

Property
Type
Description

cooldown

Long

Cooldown duration in milliseconds

id

String

A unique identifier for this cooldown

Note: The value is in milliseconds. Use 1000 for 1 second, 30000 for 30 seconds, 3600000 for 1 hour. The id field is required to track cooldown state per player. Time unit suffixes (s, ms, h, d) are only supported in the in-game editor setup, not in the YAML file directly.


Has Items

ID: has-items

Checks if the player's inventory contains specific items. Items are stored as serialized Bukkit ItemStack objects.

Tip: This is best configured through the in-game editor. The editor lets you select which items to check for.

Property
Type
Description

items

List

List of serialized Bukkit ItemStack objects to check for

ignore-durability

Boolean

When true, ignores item durability when matching


Level

ID: level-required

Checks if the player has at least the specified XP level.


XP

ID: xp-required

Checks if the player has at least the specified total experience points.


Player Points

ID: player-points

Checks the player's PlayerPoints balance. Requires the PlayerPoints plugin.

πŸ”— Using Conditions with Click Events

Conditions can be applied at two levels:

1. Item-Level Conditions

Controls whether the item is visible to the player:

2. Chat Fetcher Conditions

Validates input received from the chat fetcher:

Tip: For numeric comparisons in chat fetcher validation, use conditional-placeholder with the conditional_condition field. The is-integer and is-double conditions only validate format, not value ranges.

πŸ”„ Inverted Conditions

Any condition can be inverted to check for the opposite:

This passes when the player does not have the server.banned permission.

πŸ“Š Sorting Groups

Sorting groups allow items to serve as fallbacks for each other. If the primary item's condition fails, the next item in the group is checked β€” the first item whose conditions pass is displayed. Items in the same sorting group must share the same slot number.

Note: Sorting groups are configured through the in-game editor. The sorting-group value is stored in the item's compressed data and is not a hand-writable YAML field. Use the in-game editor to assign items to sorting groups.

Example behavior: If you have a VIP item and a default item in the same sorting group on slot 13, VIP players see the VIP item while non-VIP players see the default item.


← Previous
Next β†’

Last updated