Shop
Module shop, needs the economy module. Settings files: shop.toml, worth.json, shop.json.
Commands
| Command | What it does | Permission | Default |
|---|---|---|---|
/sell hand|all|<item> [amount] | Sell the held item, everything with a price, or one item (all of it without an amount) | brita.shop.sell | everyone |
/buy <item> [amount] | Buy an item (1 without an amount) | brita.shop.buy | everyone |
/worth [hand|<item>] [amount] | Show what an item sells for and costs | brita.shop.worth | everyone |
/shop | Open the shop menu; buying and selling in it need brita.shop.buy and .sell | brita.shop.menu | everyone |
Turn a [Buy] or [Sell] sign into a shop sign | brita.shop.signs | operators |
shop.toml has enabled (the whole shop), sell, buy, menu, signs and clickSound, all true.
sell and buy switch selling and buying off everywhere: commands, menu and signs.
Prices: worth.json
Run /brita reload after changing it. The mod writes an example with common items.
{"currency": "",
"items": {
"minecraft:diamond": {"sell": 50, "buy": 400},
"minecraft:rotten_flesh": 0.1,
"create:brass_ingot": {"buy": 12.5}
}}
currencyis a currency id fromeconomy.json; empty means the main one.- Per item id:
sellis what a player gets for one piece,buywhat one piece costs. A plain number is a sell price only. An item without a price (or with 0) cannot be sold or bought that way. - Players type items without
minecraft:(/buy diamond 5); items from other mods with their full id. - Only unchanged items are sold: damaged, enchanted, named or filled ones (such as a full shulker box) stay
with the player.
/sell <item>takes from the inventory before the hotbar. /buyrefuses what does not fit into the inventory. Money moves first, items only once it has.- Keep buy prices above sell prices, otherwise players make money by buying and selling again. The server log warns about such items, about unknown items and about broken prices, which are left out.
Shop menu
/shop opens the categories; a category opens its items, a page at a time. On an item:
| Click | Does |
|---|---|
| Left click | Buy one |
| Shift + left click | Buy a full stack (64, or 16 for items such as ender pearls) |
| Right click | Sell one |
| Shift + right click | Sell all of it |
The layout is in shop.json; run /brita reload after changing it. Anything left out keeps its default.
{"title": "shop.menu.title", "rows": 3,
"frame": "minecraft:black_stained_glass_pane", "corners": "minecraft:orange_stained_glass_pane",
"balance": {"slot": 13, "item": "minecraft:gold_ingot"}, "close": {"slot": 22, "item": "minecraft:barrier"},
"categories": [
{"slot": 11, "item": "minecraft:diamond", "name": "Ores", "lore": ["Shiny things"], "items": ["coal", "diamond"]},
{"slot": 16, "item": "minecraft:chest", "name": "shop.category.other"}
],
"page": {"rows": 6, "slots": [10, 11, 12, 13, 14, 15, 16],
"balance": {"slot": 45, "item": "minecraft:gold_ingot"}, "previous": {"slot": 48, "item": "minecraft:arrow"},
"back": {"slot": 49, "item": "minecraft:oak_door"}, "next": {"slot": 50, "item": "minecraft:arrow"},
"close": {"slot": 53, "item": "minecraft:barrier"}}}
- Slot 0 is top left; each row adds 9. Slot
-1hides a button. title,nameandloreare a key from the language files or your own text with colours.framefills every free slot,cornersthe four corners;""leaves them empty.- A category shows the items of its
itemslist that have a price, in the list's order. A category withoutitemsshows every priced item that no other category lists, so new prices appear there by themselves. page.slotsare filled with the items; previous and next only show when there is a page to turn to.
Shop signs
- Place a sign and write
[Buy]or[Sell]on line 1, the amount on line 2 (empty for 1) and the item on line 3 (diamond, orcreate:brass_ingotfor other mods). Leave line 4 empty. - Right-click it. With
brita.shop.signsthe sign becomes a shop sign: the mod writes the label, amount, item name and price, and waxes the sign so nobody can edit it. - Players right-click the sign to buy or sell that amount.
- Prices always come from
worth.json. When a price has changed, the first click updates the sign and asks the player to click again, so nobody pays a price they did not see. - Labels and the line layout are in the language files (
shop.sign.buy,shop.sign.sell,shop.sign.amount.line,shop.sign.price). Players always type[Buy]or[Sell]. - Shop signs are not protected against breaking yet; use spawn protection or a claim mod.