Placeholders
AstralCrates registers two ComplexPlaceholder namespaces with AstralCore — crate on CrateConfiguration and reward on CrateReward. For the general %namespace_key_subkey% syntax, inner placeholders, and expressions, see Placeholders.
Both namespaces are contextual, not global — neither is registered against RootPlaceholderContainer, so %crate_*% and %reward_*% only resolve inside the specific container AstralCrates hands them to: crate as a menu parameter (see below), reward via a direct registerPlaceholder call. Outside those places the placeholders simply won't resolve.
crate_*
CrateConfiguration implements ComplexPlaceholder with namespace() returning "crate". It's supplied to exactly one container: the crate preview menu, opened by CrateService#openCratePreview when a player left-clicks (or otherwise non-right-clicks) a crate block:
Because the configuration is handed in under the key "crate" of the parameters map, it's reached through AstralCore's parameters_* namespace — the full placeholder path inside that preview menu's YAML is %parameters_crate_<key>% (shortened to crate_<key> in the table below). It is not available inside CrateOpenMenu (the reward-spin UI) — that menu resolves item stacks and its title against a plain per-player container with no crate parameter registered.
Sub-key ( | Placeholder | Returns |
|---|---|---|
|
| The crate's |
|
| The configured key, built from the |
|
| An |
|
| The |
|
| The preview menu's own |
|
| The preview menu's |
Any other sub-key falls to the default branch and returns null — locations, hologram, open-actions/win-actions are not exposed as placeholder sub-keys, only id, key, rewards, and menu.
reward_*
CrateReward implements ComplexPlaceholder with namespace() returning "reward". Unlike crate_* above, it is registered directly into a container — registerPlaceholder(Placeholder) stores an entry keyed by the placeholder's own namespace(), so no parameters_ prefix is needed. CrateListener does this once, right after CrateOpenMenu picks a winner, so the crate's win-actions can reference the reward the player just won:
%reward_*% therefore only resolves inside win-actions. It is not available to open-actions (which run once per key, independent of which reward was drawn) or to the reward's own actions list (run with a plain per-player container, before win-actions), nor inside CrateOpenMenu's spin animation itself.
Sub-key ( | Placeholder | Returns |
|---|---|---|
|
| The reward's |
|
| The reward's relative weight ( |
Any other sub-key returns null — actions and requirements are not exposed as placeholder sub-keys.
%item_name% in key-needed
When a player right-clicks a crate block without holding a valid key, CrateListener#onInteract sends the key-needed message against a container built just for that call:
new ItemStackPlaceholder(itemStack) (the one-argument constructor) registers under the default namespace "item", wrapping the crate's already-built key ItemStack — this is AstralCore's generic runtime item placeholder (distinct from the config-time ItemStackWrapper behind %crate_key%/%reward_item%, and it does support full sub-key chaining). key-needed's shipped text only uses %item_name%, but any of the sub-keys documented under Equipment sub-keys (material, name, hover-name, lore, amount, custom-model-data, durability, damage, enchantments, unbreakable) resolve the same way here. Like crate_*/reward_*, this item registration is local to this one message send — it is not available anywhere else in the plugin.