Actions
AstralShop registers three PaperActions in AstralShop#onEnable, one per record class in com.astralrealms.shop.action (BuyShopItemAction, SellShopItemAction, SellAllAction):
All three use the plain registerAction call, not registerActionGlobally — so, unlike some other products' action sets, they resolve only inside action lists that AstralShop's own configuration loader parses: a shop item's buy-actions/sell-actions (shops/*.yml) and a menu button's actions: block (menus/*.yml, both under AstralShop's own data folder). See Shop Configuration — buy-actions and sell-actions and Menu rendering.
Every argument is declared as a PlaceholderWrapper record component and resolved with context.parseWrapper(...) when the action runs, so each one accepts a literal (wood), a placeholder (%shop_id%, %item_id%), or a mix. The action always acts on context.executor() — the player who triggered it (e.g. the one who clicked the menu slot) — there is no separate "target player" argument.
All three call straight into PaperShopService, the exact same methods backing /shop, /sellall, and /sellhand — same buyable/sellable checks, the same cancellable ShopBuyEvent/ShopSellEvent, the same per-player price modifiers, and the same EconomyService withdraw/deposit. See Overview — Buying, selling, and sell-all for the shared flow in full.
buy-shop-item
Buys amount of item-id from shop-id for the executing player.
Arg | Type | Description |
|---|---|---|
| String placeholder | The shop's |
| String placeholder | The item's key under that shop's |
| Integer placeholder | Quantity to buy. |
Calls PaperShopService#buy(player, shopId, itemId, amount): validates buyable, computes the price through per-player modifiers, fires ShopBuyEvent, withdraws via EconomyService, then either grants the item's display stack or runs its buy-actions, depending on give-item. Depending on outcome, sends shop-not-found, item-not-buyable, inventory-full, not-enough-funds, or item-bought — see Messages — Buy.
sell-shop-item
Sells amount of item-id from shop-id, out of the executing player's inventory.
Arg | Type | Description |
|---|---|---|
| String placeholder | The shop's |
| String placeholder | The item's key under that shop's |
| Integer placeholder | Quantity to sell. |
Calls PaperShopService#sell(player, shopId, itemId, amount) (the notifying overload — same as a direct player sell): validates sellable and that the player holds at least amount, computes the price, fires ShopSellEvent, deposits via EconomyService, removes the items, and always runs the item's sell-actions if present. Sends shop-not-found, item-not-sellable, not-enough-items, or item-sold — see Messages — Sell.
sell-all
Sells every sellable item the executing player holds, scoped to one shop.
Arg | Type | Description |
|---|---|---|
| String placeholder | The shop to sweep. |
Calls PaperShopService#sellAll(player, shopId) — the shop-scoped overload, distinct from the no-arg sellAll(player) overload behind /sellall, which sweeps every loaded shop instead of one (see Commands — /sellall). Each matching item sells silently (no per-item message); once every sale settles, one combined sold-all-items message reports the total, or nothing-to-sell if the player held nothing sellable in that shop. See Messages — Sell All/Hand.
Wiring example: a shop menu item
The intended home for these three is a rendered shop item's actions: block — the same pattern shown in Placeholders — How these are wired:
None of the three actions check a permission node themselves — gate who can click a wired button through the menu item's own view-requirements/ click requirements, not the action.
Action Summary Table
ID | Arguments | Effect |
|---|---|---|
|
| Buys |
|
| Sells |
|
| Sells every sellable item the executor holds, scoped to that one shop. |
See also
Overview — Buying, selling, and sell-all — the shared buy/sell/sell-all flow these actions trigger.
Shop Configuration —
shop-id/item-idcome from a shop'sidand itsitems:map keys.Commands —
/shop,/sellall,/sellhand, the command-driven equivalents.Messages — the full text and placeholders for every message these actions can send.
Placeholders —
%shop_id%/%item_id%, typically used as these actions' arguments.Developer API —
ShopBuyEvent/ShopSellEvent, fired before every buy/sell these actions trigger.