Condition System
Conditions decide whether an operation is allowed to continue. They are used by recipes, strengthening, skills, items, GUI buttons, and actions.
Unified block
Modules use condition as the unified condition block entry. CoreLib parses it through ConditionBlock.
condition:
type: all_of
entries:
- '%player_level% >= 10'
- '%money% >= 1000'
required_count: 0
invalid_as_failure: true| Field | Type | Default | Meaning |
|---|---|---|---|
condition.type | string | all_of | Combination mode. |
condition.entries | list | [] | Condition entries. |
condition.required_count | integer | 0 | Required passing count for at_least and exactly. |
condition.invalid_as_failure | boolean | true | Treat invalid or unevaluatable configuration as failure. |
condition.on_pass.actions | list | [] | Actions to run when the condition passes, when supported by the caller. |
condition.on_fail.actions | list | [] | Actions to run when the condition fails, when supported by the caller. |
condition.on_fail.block_output | boolean | false | Block output on failure, used by output-producing modules such as Cooking. |
condition.on_fail.message | string | "" | Failure message for modules such as Item equipment checks. |
Combination modes
| Value | Meaning |
|---|---|
all_of | Every condition must be true. Use for strict gates. |
any_of | At least one condition must be true. Use for alternative unlock paths. |
none_of | Every condition must be false. Use for exclusion checks. |
at_least | At least required_count conditions are true. Use for substitutable requirements. |
exactly | Exactly required_count conditions are true. Use for precise matching. |
required_count only applies to at_least and exactly. For at_least a value of zero or less is treated as 1. When the entry list is empty the group always returns true.
Nested groups are written as entries with their own type and entries:
condition:
type: all_of
entries:
- type: any_of
entries:
- '%vip_level% >= 1'
- '%player_level% >= 50'
- '%money% >= 5000'An expression entry may also be written in object form. The expression must go in the expression field; condition and value are not read, so an entry using them has an empty expression and stops working.
condition:
type: all_of
entries:
- type: expression
expression: '%player_level% >= 20 && %money% >= 1000'Expression operators
Condition expressions are evaluated by CoreLib's boolean expression engine.
| Operator | Meaning | Example |
|---|---|---|
== | Equal | %phase% == "success" |
!= | Not equal | %world% != "world_nether" |
< | Less than | %level% < 10 |
<= | Less than or equal | %star% <= 5 |
> | Greater than | %score% > 100 |
>= | Greater than or equal | %player_level% >= 20 |
&& | AND | %level% >= 10 && %money% >= 100 |
|| | OR | %rarity% == "rare" || %rarity% == "epic" |
! | NOT | !%locked% |
() | Grouping | (%a% > 0 && %b% > 0) || %admin% |
The engine tries numeric evaluation first. When a side cannot be evaluated numerically, only string == / != comparison is supported. Quote string right-hand values.
How invalid_as_failure behaves
This flag decides what happens when an entry cannot be evaluated at all — a missing variable, a syntax error, or an optional plugin that is not loaded.
invalid_as_failure: true(default): an unevaluatable entry fails the whole group and the operation is blocked. Recommended for production, so a config mistake cannot let players bypass a restriction.invalid_as_failure: false: an unevaluatable entry is skipped and does not count toward the result. Useful while developing, or when an entry depends on an optional plugin.
When every entry is skipped this way, the group returns true under invalid_as_failure: false and false under invalid_as_failure: true.
condition:
invalid_as_failure: true
entries:
- '%attribute_attack% >= 100'Variable sources
The %name% variables in a condition expression are injected by the calling module, so the available set differs per context:
| Context | Common variables |
|---|---|
| Strengthen | %star%, %level%, %recipe_id% |
| Forge | %quality%, %recipe_id%, %material_count% |
| Skills | %skill_level%, %skill_id%, %cooldown% |
| Gem | %gem_level%, %slot_count%, %gem_type% |
| Item triggers | %item_id%, %trigger_type% |
| General | %player_level%, %money%, %world%, %has_permission_xxx% |
See each module's own page for the variables it actually injects. A missing variable fails the condition when invalid_as_failure is true.
PlaceholderAPI
When PlaceholderAPI is installed, %placeholder% tokens in condition expressions are resolved before evaluation.
condition:
entries:
- '%player_level% >= 30'
- '%vault_eco_balance% >= 10000'PAPI placeholders return strings. A value carrying colour codes or non-numeric characters can break numeric comparison, so prefer placeholders that return plain numbers.
Advice
Use clear failure messages for players. For important restrictions, keep invalid configuration as failure to avoid bypasses.