Shop

/farmpoints shop opens a menu of things farmpoints buy. Everything in it comes from shop.yml.

What an entry can be

An item

A stack handed to the player. Material, amount, name, lore, model data, or an ItemsAdder id.

A command

Leave the give material as AIR and list console commands instead. {player} is the buyer.

Both

Commands run alongside the item, so a purchase can hand over a kit and grant a rank.

A boost

type: boost grants a personal xp, money or farmpoints multiplier for a set number of seconds.

How a purchase runs

  1. Player clicks the icon
    The display item, not the item they get, so the icon can show a price line.

  2. Price is checked
    Not enough farmpoints and the purchase stops with a message.

  3. Points are taken
    The price value, in farmpoints.

  4. The entry is handed over
    The item is added, the commands run, and any boost starts counting down.

Nothing stops a full inventory

A player buying an item with a full inventory can drop it on the floor. Keep command-only entries for anything expensive.

Entries that do not show up

Shop entries are drawn over the menu frame, so an entry sitting on the balance item, the filler or the close button wins and the button under it stops working. Two entries on the same slot means only one of them shows, and the console names both on load.

An entry that says type: boost but cannot grant a boost, because the boost block is missing or its duration is 0, is kept out of the shop entirely rather than taking farmpoints and handing over nothing. The console says which entry and what is wrong with it, every start, until it is fixed or removed.

An entry with no give block at all gives nothing, the same as material: AIR.

A worked example

xp-boost:
  slot: 16
  price: 500
  type: boost
  boost:
    boost-type: xp
    job: all
    multiplier: 2.0
    duration: 1800
  display:
    material: EXPERIENCE_BOTTLE
    name: "lang:content.shop.xp-boost.name"
    lore:
      - "lang:content.shop.xp-boost.lore"

500 farmpoints for double xp on every job for 30 minutes. Set job to a single job id to keep a boost narrow, and boost-type to money or farmpoints to sell the other two categories. The bundled shop sells one of each.

Prices and display

Key What it does
slot Where the icon sits in the shop menu, 0-indexed
price Farmpoints taken on purchase
give The item handed over, AIR for nothing
commands Console commands on purchase, {player} replaced
display How the icon looks. {price} in a lore line prints the cost

Leave display.name and display.lore empty to fall back to the give item’s own name.

Translated shop text

Any name or lore line written as lang:content.shop.<id>.name is read from the player’s language file, so the shop follows the same language as the rest of the menus. Write literal text for one wording everywhere.

Adding entries from in game

/corejobs shop boost mega-xp 24 2500 xp all 3.0 3600
/corejobs shop add spawner-egg 25 5000
/corejobs shop remove mega-xp
/corejobs shop list

shop boost writes a boost entry, shop add sells the item in your hand, shop remove takes one out. Each one saves shop.yml and reloads the shop, and what it writes is plain shop.yml you can keep editing by hand.

A bundled entry you remove is written as enabled: false rather than deleted, because the file updater puts a deleted bundled entry back on the next start.

Next

Every field with its default is on shop.yml. Boost behaviour is on Boosts.