Shop Products
A Shop Product is a JSON Object that defines an item, a name, and buy or sell prices. The only required field is item - if you omit the name field, the item's name is used instead. If you don't want the player to be able to sell the item, just don't define the sell price.
Product format
Each entry in products can include:
item(object, required) - ItemBuilder JSON used for display and, for item products, the given itemname(string, optional) - overrides the display namebuy(number or object, optional) - purchase pricesell(number or object, optional) - sell price (item products only)limit(number, optional) - per-player purchase limitcommand(string, optional) - if set, the product becomes a command product and executes on purchase
If command is set, the product is not an item product and selling is ignored. Use {player} in commands to insert the player's name.
Purchase behavior
Left-click buys when
buyis definedRight-click sells when
sellis defined and the product is an item productlimittracks purchases per player and blocks additional buys after the limit is reached
Lets play around with the Block Shop from Creating Shops to explore this.
The Block Shop example has two Item Shop Products - 16x Oak Logs, and 16x Spruce Logs. Both products are available for purchase, and both can be sold to the shop by the player. A player can purchase 16x Oak Log for $150, and sell 16x Oak Logs to the shop for $50.
If we don't want to let the player purchase Oak Logs, we can remove the "buy" key.

Now the only option for the player is to sell logs, not to purchase them. You could instead remove the "sell" key and just keep "buy" to stop players from selling.
Last updated