Placeholders
AstralShop exposes two ComplexPlaceholder namespaces, shop and item, wrapping ShopConfiguration and ShopItem respectively. Neither is registered globally with AstralCore — both only exist inside the placeholder context MenuService#openShopMenu builds for the shop menu blueprint (plus wherever PaperShopService registers a ShopItem directly, e.g. buy/sell messages — see below). For the placeholder syntax itself (%a_b_c%, chaining, $e(...)) see Placeholders.
shop_* (ShopConfiguration)
ShopConfiguration implements ComplexPlaceholder under namespace shop.
Placeholder | Type | Description |
|---|---|---|
| String | The shop's |
| Component | The shop's |
|
| The shop's configured |
| ItemProvider (of | Every |
Any sub-key other than id, title, slots, or items resolves to null (the switch's case null, default branch). See Shop Configuration for the YAML these fields come from.
item_* (ShopItem)
ShopItem implements ComplexPlaceholder under namespace item. Reached by iterating %shop_items%, or wherever a ShopItem is registered directly into a placeholder container.
Placeholder | Type | Description |
|---|---|---|
| String | The item's id (its key in the shop's |
| double | The buy price, recomputed with the viewing player's price modifiers ( |
| double | The sell price, recomputed the same way for |
| ItemStackPlaceholder | The configured |
| boolean | Whether the item can be bought. |
| boolean | Whether the item can be sold. |
| boolean | Whether buying gives the |
Any other sub-key (including name) falls through to null.
How these are wired
MenuService#openShopMenu hands the opened ShopConfiguration to AstralCore's MenuContainer as the shop menu parameter:
That makes %shop_*% available anywhere in the shop menu blueprint's placeholder context. A layout then iterates %shop_items% and renders each element's %item_*% placeholders per slot — AstralShop itself does not ship a menus/shop.yml blueprint (see Shop Configuration — Menu rendering), so this is illustrative of what such a blueprint would look like:
Item placeholders in messages
PaperShopService also registers the item placeholder directly (registerPlaceholder(item)) into the placeholder container used for the buy/sell message flows, alongside %amount% and %price%. That means every %item_*% sub-key documented above also resolves inside the item-bought, item-sold, and not-enough-items message templates. See Messages — Placeholders for the full breakdown, including a shipped-default inconsistency: messages.yml uses %item_name%, which is not a valid item_* sub-key (the working equivalent is %item_display_name%).
Summary
Placeholder | Returns |
|---|---|
| The shop's id. |
| The shop's title component. |
| The shop's configured slot list. |
|
|
| The item's id. |
| Buy price, player-modifier-adjusted; |
| Sell price, player-modifier-adjusted; |
| The item's display |
| Whether the item can be bought. |
| Whether the item can be sold. |
| Whether buying gives the item directly instead of running |
See also
Shop Configuration — the
shop/itemsYAML these placeholders read from.Messages — where
%item_*%also resolves, and the%item_name%inconsistency.Actions —
[buy-shop-item]/[sell-shop-item], the actions typically triggered from a rendered%item_*%slot.Developer API —
ShopBuyEvent/ShopSellEvent, fired before the placeholders above are used to build a message.