Custom Actions
You can register new action types that become available in all menu and dialog YAML files after registration.
Step 1 — Implement Action
Constructor argument resolution
Constructor parameters are resolved from the action's argument string using registered AstralAdapter implementations. The adapters for the most common types are already registered:
Java type | Resolved from |
|---|---|
| Parsed integer |
| Parsed double |
| Parsed float |
|
|
| Raw argument string |
| MiniMessage-parsed component |
| Wrapped MiniMessage string |
| Adventure sound key |
| Adventure namespaced key |
| UUID string |
| World name lookup |
| Bukkit registry lookup |
|
|
| ISO 8601 string (e.g. |
For custom types, register a new adapter:
Step 2 — Register the Action
Call this during your plugin's onEnable:
The first argument is the action ID used in YAML.
Step 3 — Use in YAML
The argument string (500) is passed to the int amount constructor parameter.
Multi-parameter Actions
If an action takes multiple constructor parameters, separate values in the argument string by a space or use a custom format — the adapter receives the full raw argument string:
For multi-parameter constructors you may need to register a custom adapter that splits the string manually instead of relying on the generic GenericConstructorAdapter:
Placeholder Substitution
The argument string has all %placeholder% tokens substituted before the adapter runs. This means your action receives already-resolved values:
The GiveExpAction constructor receives the integer value of %param.reward_exp%, not the placeholder string.