Custom Requirements
You can register new requirement types that become available in view-requirements and clicks-requirements blocks of any menu or dialog YAML.
Step 1 — Implement Requirement
Constructor argument resolution
Exactly the same adapter system used for actions applies here. Register adapters for any custom constructor types via AstralPaperAPI.registerAdapter(...).
Step 2 — Register the Requirement
Step 3 — Use in YAML
Inline (shorthand)
Object form (with deny-actions)
Deny Actions
When using the object form, deny-actions is a list of actions executed on the player if this requirement returns false. This is the correct place to send feedback messages.
Placeholder Substitution in Requirements
The value string (or inline argument) has all %placeholder% tokens substituted before the constructor runs:
The HasMoneyRequirement receives the numeric value resolved from %param.price%.
Context Object
The context parameter in test(Player player, Object context) is the menu's MenuContext when the requirement is evaluated inside a menu. It implements Function<String, Object> so you can resolve placeholders from it: