Commands
Shops
modules/shops.yml
Three separate things live here: selling to the server, sign shops the server runs, and chest shops players run themselves.
| Command | Permission |
|---|---|
/sell <hand|all|item> [amount] |
chorus.shops.sell |
/worth [hand|item] [amount] |
chorus.shops.worth |
/setworth <item> <price> |
chorus.shops.admin |
/shop [info|price|mode|remove|unlimited|list] |
chorus.shops.chest.use |
Selling to the server#
shops:
sell-multiplier: 1.0
worth:
diamond: 60.0
iron_ingot: 6.0
coal: 2.0worth is what the server pays for each item. An item that is not listed cannot be sold at
all.
sell-multiplier scales every price on the way out, so 0.8 pays eighty per cent without
editing the list. It is the main tap on money entering a server, and the number worth watching
once the economy has run for a month.
/worth hand what the server pays for what you are holding
/worth diamond 64 for a stack
/sell hand sell what you are holding
/sell all sell everything you are carrying that has a price
/setworth diamond 75 change a price
/setworth diamond 0 take an item off the list/setworth writes back into shops.yml, so a price set in game is still there after a
restart.
/sell all leaves anything renamed, enchanted or damaged alone, so a named sword can never
go for the price of the metal. It is what a player coming back from a mine actually wants.
Sign shops#
Shops the server runs, on signs. Four lines: what the sign does, how many, what, and for how much.
[Buy] [Sell]
64 32
diamond iron_ingot
250 40Right-clicking buys or sells. Nothing runs out of stock — these are the server's own shops, which is what those two words on the first line have meant since somebody first wrote them.
A [Sell] sign may leave the price line empty, in which case the item is worth whatever the
worth list says. A [Buy] sign always has to name its price.
Making one needs chorus.shops.create, using one chorus.shops.use. shops.signs: false
leaves them as ordinary signs.
Chest shops#
Shops players run themselves, out of their own chests.
shops:
chest:
enabled: true
default-limit: 5
display: true
creation-cost: 0.0
protect-hoppers: true
max-price: 1000000.0
reach: 8Making one#
Hold what you want to sell, put a sign on a chest, barrel or trapped chest, and write [Shop]
on the first line. The price is asked for in chat, and the sign writes itself:
Ghost_chu
Selling 5
Diamond
$125.12 eachWrite buy on the second line instead for a shop that buys from players.
Needs chorus.shops.chest.create. creation-cost is what making one costs.
Using one#
Right-clicking somebody else's shop shows what it holds and asks how many you want. all
takes as many as the stock, your money and your inventory allow.
Managing one#
/shop info what this shop is
/shop price 250 change what it charges
/shop mode swap between selling and buying
/shop remove take it down
/shop unlimited admin only, see below
/shop list all of yours/shop acts on the shop you are looking at.
Limits#
default-limit is shops per player. Raise it per rank:
lp group vip permission set chorus.shops.chest.limit.20max-price is the most one item may be priced at, so a mistyped price cannot empty somebody.
reach is how far from the shop a trade may still be finished, in blocks.
Admin shops#
An admin with chorus.shops.chest.unlimited can write admin on the second line, or run
/shop unlimited, for a shop that never runs out and never pays out.
chorus.shops.chest.admin reaches every chest shop, whoever owns it.
The floating item#
display: true turns the item slowly above the chest, so you can see what a shop sells from
across the road.
It is a dropped item with everything that makes a dropped item behave taken away: no gravity, no ageing, no despawning, no picking up, no merging with the one over the shop next door.
It is never written to the world file. That is what makes it impossible for a crash to leave one behind — they go when a chunk unloads and come back when it loads again, and there is no way for them to build up into a field of floating diamonds nobody can explain.
Protection#
The container, its sign and the other half of a double chest cannot be:
- broken by anybody but the owner
- blown up
- pushed by a piston
- merged into by a second chest placed next to it
- drained by a hopper, with
protect-hoppers: true
Taking a shop down closes it rather than leaving a sign pointing at nothing.
Nothing duplicates#
This is the whole design of the trade, so it is worth saying how:
- Everything is measured again at the moment of the trade. How much stock, how much room, how much money — all read from the live inventories, never from what the screen said a few seconds earlier.
- Items only ever move from one place to another. Nothing is built from a template and handed over while the original stays where it was, which is the shape every duplication bug has.
- Every step after the first is reversible, and is reversed on failure. If the money will not move, the items go back where they came from before anybody is told anything.
- There is no waiting in the middle. No database call, no scheduled task, no callback — from the first measurement to the last item there is no point at which another player can act.
The one thing that can still go wrong is money disappearing, if a deposit is refused after a withdrawal went through. That is the right way round, and it is reported so it can be put right by hand.
Signs heal themselves#
A chest shop sign rewrites itself the next time its chunk loads. That covers an imported shop still carrying another plugin's sign, and a sign a rollback left saying the wrong thing.
Coming from QuickShop#
/chorus import quickshopBrings every player shop across. See Importing from another plugin.
Config reference#
enabled: true
shops:
signs: true
chest:
enabled: true
default-limit: 5
display: true
creation-cost: 0.0
protect-hoppers: true
max-price: 1000000.0
reach: 8
sell-multiplier: 1.0
worth:
coal: 2.0
diamond: 60.0
# ... about forty items ship
commands:
defaults: ...
sell: ...
worth: ...
setworth: ...
shop: ...Permissions#
| Permission | Effect |
|---|---|
chorus.shops.sell |
/sell |
chorus.shops.worth |
/worth |
chorus.shops.admin |
/setworth |
chorus.shops.use |
Uses a [Buy] or [Sell] sign |
chorus.shops.create |
Makes one |
chorus.shops.chest.use |
Trades at a chest shop, and /shop |
chorus.shops.chest.create |
Makes a chest shop |
chorus.shops.chest.limit.<n> |
Raises how many one player may own |
chorus.shops.chest.admin |
Reaches every chest shop |
chorus.shops.chest.unlimited |
A shop with no stock and no till |
