Shop and Claims
The main menu, the minion shop with its categories and prices, and the queue that holds items for players.
The main menu is where players start: it leads to the shop, their placed minions and anything waiting for them. The shop sells minions, fuel, upgrades and any other item for money, items or another currency. Nothing a player buys or is given ever gets lost, because whatever does not fit waits in the claim queue until they have room.
The main menu
Players open it with /minion, which needs minioncore.use. Its layout is main in gui.yml.
| Slot | Button | What a click does |
|---|---|---|
11 | Shop | Opens the shop. Only shown while the shop is switched on and the player has minioncore.shop |
13 | Your minions | Opens the list of minions the player has placed. %count% shows how many |
15 | Waiting items | Hands over what is in the claim queue. %amount% shows how many items are waiting in total, counting every item in every stack |
See Menus to move buttons or change their look.
The shop
Players open the shop from the main menu or with /minion shop, which needs minioncore.shop. The first page shows one button per category, and a category opens its own pages of entries.
shop.yml
enabled: true
categories:
minions:
slot: 10
name: "<green>Minions"
lore:
- "<gray>Buy a minion to place down."
material: PLAYER_HEAD
permission: ""
items:
miner:
page: 1
slot: 10
sells: MINION
target: miner
level: 1
amount: 1
price:
money: 100000
permission: ""
commands: []
display:
material: IRON_PICKAXE
name: "<green>Miner Minion"
lore:
- "<gray>Mines the blocks around it."
- "<#b6f5b6>✪ <white>Price: <green>%price%"enabled: false switches the shop off: the Shop button disappears from the main menu and /minion shop is treated as an unknown command.
Categories
Every key under categories is one category. The key itself is only an id.
| Key | What it does |
|---|---|
slot | The slot of the category button on the first shop page |
name, lore, material | How the button looks. Other item keys such as custom-model-data work too |
permission | Players without it do not see the category. Empty means everyone |
items | The entries in this category |
The first page has six rows, and slot 49 holds the close button.
Entries
Every key under a category's items is one entry.
| Key | What it does |
|---|---|
enabled | false hides the entry so it cannot be bought. Left out, it counts as true. The shipped feeder and seller entries are off |
page | The page of the category the entry is on. The category has as many pages as its highest page |
slot | The slot on that page. Use 0 to 44: the last row holds the page and back buttons |
sells | What is sold: MINION, FUEL, UPGRADE or ITEM. Missing means ITEM |
target | For MINION a minion type id, for FUEL a fuel id from fuel.yml or a type fuel such as miner:coal, for UPGRADE an upgrade id from upgrades.yml. Not used for ITEM |
level | The level a bought minion starts at, up to the type's highest level. Only used for MINION |
amount | How many are given per purchase |
price | What it costs, as currency id and amount. See below |
permission | Players without it cannot buy the entry. They can still see it. Empty means everyone |
commands | Console commands run after a purchase. %player% and %amount% are filled in |
display | How the entry looks in the menu. %price% and %amount% work in its name and lore. For UPGRADE, material: UPGRADE shows the look of the upgrade being sold, see Menus |
item | For ITEM only, the item to give, written like any item in the config |
A type id is the type file's name without .yml, such as miner or chunkloader.
An ITEM entry without an item section gives nothing and only runs its commands. Use that to sell ranks, kits or anything else another plugin hands out.
Prices
A price lists one or more currency ids with an amount each. The ids come from currencies in upgrades.yml, the same ones levels and upgrades use.
price:
money: 50000
diamonds: 8| Shipped id | Type | Pays with |
|---|---|---|
money | VAULT | The Vault economy |
tokens | COMMAND | A balance placeholder and console commands, set up for TokenManager |
diamonds | ITEM | Diamonds from the player's inventory |
A price with no entries is free and shows as None. See Fuel and upgrades for setting up currencies.
Shipped entries
| Category | Button slot | Entry | Sells | Amount | Price |
|---|---|---|---|---|---|
minions | 10 | miner | MINION miner at level 1 | 1 | money: 100000 |
fuel | 12 | basic | FUEL basic | 16 | money: 5000 |
upgrades | 14 | storage | UPGRADE storage-1 | 1 | money: 10000 |
upgrades | 14 | speed | UPGRADE speed | 1 | money: 25000 |
These are examples to build on. Add an entry for every minion type you want to sell.
Buying
A purchase runs its checks in order and stops at the first one that fails:
- The shop is switched on.
- The player did not buy something in the last half second. This stops a fast double click from buying twice.
- The player has the entry's
permission. - Every currency in the price exists and is working, for example Vault has an economy.
- The
targetexists. - Everything fits in the player's inventory. The player is told before any money is taken.
- The player can afford the whole price.
- Every part of the price is taken. If one part fails, the parts already taken are given back and nothing is bought.
Then the items go into the inventory, the commands run, and the player gets a message. Each failed check has its own message under shop in the language file, except the half second one, which does nothing.
A bought minion is a fresh item at the entry's level, with no upgrades and no fuel.
The claim queue
The claim queue keeps items that could not be handed to a player, and gives them over later. It is saved in the database, so it survives restarts.
What goes into it
- Shop items that did not fit into the inventory after all.
- Minions, fuel and upgrades from
/minion give,/minion fueland/minion upgrade, when the player is offline or their inventory is full. - A picked up minion and its storage, when they do not fit.
- Minions an admin removes while their owner is offline, with everything that was in their storage.
- A minion item given back after a placement failed at the last step and it did not fit.
- A minion that shared its block with another one when the server started. It comes back as a minion item with its storage, level and upgrades, see Placing and picking up.
How players get it
- On join. Two seconds after a player joins, everything waiting is moved into their inventory. When it all fits,
claim.claimedsays how many items arrived. When some did not fit, the player getsclaim.waitinginstead, with the number of items still waiting and the command that opens the main menu. - From the main menu. The Waiting items button in slot
15does the same at any time.
If the inventory fills up part way while claiming from the menu, the rest stays in the queue and the player gets claim.inventory-full. They can use the Waiting items button once they have room.