Skip to content

purchase-menu.yml

The buy screen - the item preview, quantity presets, the custom amount button and its temporary icons.

guis/purchase-menu.yml opens when a player clicks someone else’s listing. It shows the item and lets the buyer pick how many to take. After editing, run /ahadmin reload.

It uses the same Title, Size, Items and Temporary-Icons format as the other menus, plus three keys of its own.

Title: "Purchase Item"
Size: 27
Listing-Slot: 4
Items:
Filler-Item:
Material: BLACK_STAINED_GLASS_PANE
Name: "&r"
Slots: [0-26]
Custom-Amount-Item:
Material: PURPLE_DYE
Slot: 16
Name: "&d&lCustom Amount"
Lore:
- "&5 - &7Stock: &fx{stock}"
- "&5 - &7Price: {unit-price} {currency} &7each"
- ""
- "&e➥ Click to enter amount!"
Cancel-Item:
Material: RED_DYE
Slot: 22
Name: "&c&lCancel Action"
Actions:
- "[back]"
Presets:
Single:
Material: LIME_DYE
Slot: 10
Name: "&a&lBuy &2&lx{amount}"
Lore:
- "&2 - &7Price: {unit-price} {currency} &7each"
- "&2 - &7Total: {price} {currency}"
Amount: 1
Key Description
Listing-Slot Required. Where the listed item is shown, with Purchase-Lore from config.yml added below its own lore. Must fit in Size.
Presets Required, at least one. Each entry is a quantity button.
Items.Custom-Amount-Item Optional. Clicking it asks the buyer to type an amount. The id must stay Custom-Amount-Item.

Any other item runs its Actions as usual; the shipped Cancel-Item uses [back] to return to the board.

Each preset is an item (same fields as any menu item) plus:

Key Description
Slot / Slots Required. Where the button goes.
Amount How many items it buys. A positive number, or -1 for everything left. 0 or below -1 fails the load.

The amount is capped to the stock left, so a 64 preset on a listing with 3 left shows and buys 3.

Shipped presets:

Preset Slot Amount
Single (lime dye) 10 1
Stack (yellow dye) 12 64
Everything (light blue dye) 14 -1

Add as many as you like, for example a x16 button:

Sixteen:
Material: ORANGE_DYE
Slot: 11
Name: "&6&lBuy &e&lx{amount}"
Lore:
- "&6 - &7Total: {price} {currency}"
- ""
- "&e➥ Click to purchase!"
Amount: 16

Every item in this menu gets the listing tokens of the listing being bought ({item}, {seller}, {unit-price}, {currency}, {expires}, …) plus {player}. The title gets them too.

Preset buttons override three of them for their own quantity:

Token In a preset
{amount} The quantity this button buys.
{stock} The same quantity, comma-grouped.
{price} The total cost of that quantity, in the currency’s primary color.

Everywhere else in the menu {stock} and {price} describe the whole remaining listing.

A click on a preset (or a typed custom amount) checks, in order:

  1. The listing’s currency is available.
  2. It is not the buyer’s own listing.
  3. The listing still has stock.
  4. The buyer can afford the total.
  5. The buyer’s inventory has room for all the items.

If any check fails the buyer gets the matching message, the DENIED sound plays and a temporary icon flashes on the clicked button. On success the menu stays open with the new stock; once the listing is sold out the buyer goes back to the board.

For a custom amount, the buyer types a number of at least 1 (suffixes like 1k work, decimals are rounded down). More than the stock left simply buys everything left. cancel or a closed anvil returns to the purchase menu. An invalid number sends INVALID-NUMBER.

Temporary-Icons:
Listing-Gone:
Material: BARRIER
Name: "&c&lError!"
Lore:
- "&7This listing is no longer available!"
Insufficient-Funds:
Material: BARRIER
Name: "&c&lError!"
Lore:
- "&7You don't have enough funds for this!"
Inventory-Full:
Material: BARRIER
Name: "&c&lError!"
Lore:
- "&7Your inventory is full!"
Icon Flashed when
Listing-Gone The listing is sold out or no longer active, it is the buyer’s own listing, or its currency is unavailable.
Insufficient-Funds The buyer can’t afford the total.
Inventory-Full The items don’t fit in the buyer’s inventory.

These icons get the listing tokens, so {item} or {stock} work in their lore.