MinionCore logoMinionCore

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.

SlotButtonWhat a click does
11ShopOpens the shop. Only shown while the shop is switched on and the player has minioncore.shop
13Your minionsOpens the list of minions the player has placed. %count% shows how many
15Waiting itemsHands 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.

KeyWhat it does
slotThe slot of the category button on the first shop page
name, lore, materialHow the button looks. Other item keys such as custom-model-data work too
permissionPlayers without it do not see the category. Empty means everyone
itemsThe 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.

KeyWhat it does
enabledfalse hides the entry so it cannot be bought. Left out, it counts as true. The shipped feeder and seller entries are off
pageThe page of the category the entry is on. The category has as many pages as its highest page
slotThe slot on that page. Use 0 to 44: the last row holds the page and back buttons
sellsWhat is sold: MINION, FUEL, UPGRADE or ITEM. Missing means ITEM
targetFor 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
levelThe level a bought minion starts at, up to the type's highest level. Only used for MINION
amountHow many are given per purchase
priceWhat it costs, as currency id and amount. See below
permissionPlayers without it cannot buy the entry. They can still see it. Empty means everyone
commandsConsole commands run after a purchase. %player% and %amount% are filled in
displayHow 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
itemFor 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 idTypePays with
moneyVAULTThe Vault economy
tokensCOMMANDA balance placeholder and console commands, set up for TokenManager
diamondsITEMDiamonds 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

CategoryButton slotEntrySellsAmountPrice
minions10minerMINION miner at level 11money: 100000
fuel12basicFUEL basic16money: 5000
upgrades14storageUPGRADE storage-11money: 10000
upgrades14speedUPGRADE speed1money: 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:

  1. The shop is switched on.
  2. The player did not buy something in the last half second. This stops a fast double click from buying twice.
  3. The player has the entry's permission.
  4. Every currency in the price exists and is working, for example Vault has an economy.
  5. The target exists.
  6. Everything fits in the player's inventory. The player is told before any money is taken.
  7. The player can afford the whole price.
  8. 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 fuel and /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.claimed says how many items arrived. When some did not fit, the player gets claim.waiting instead, 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 15 does 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.

On this page