Skip to content
Stock & Limits

Stock & Limits

Stock

# 500 units, starting full, restocked by hand only
netherite_ingot:
  buy: 1800
  stock: 500

# 8 more every hour, up to 64
golden_apple:
  buy: 85.5
  stock: { max: 64, every: 1h, restock: 8 }

# Back to 5 every day
totem_of_undying:
  buy: 400
  stock: { max: 5, every: 1d }

# Only what players have sold, up to 1000
diamond:
  buy: 80
  sell: 20
  stock: { max: 1000, fed-by-players: true }
KeyDefaultDescription
maxrequiredThe most the shop holds
startmax, or 0 when fed by playersWhat it holds the first time the product is seen
everyneverHow long between two restocks
restockfull when every is setHow many units come back at each restock, or full to go back to max
fed-by-playersfalseWhat players sell goes into the stock, and what they buy comes out of it
  • A restock without every is never applied, and the console says so.
  • Restocks are looked at every half minute. A shop closed for a week fills up to its max, not past it.
  • A stock fed by players stops buying once it is full: The shop does not want any more of this for now.
  • A purchase larger than what is left buys what is left. Out of stock, the product says when it restocks.
  • The stock is taken by a statement the database refuses when there is not enough: two players on two servers cannot both buy the last unit. On a network, a restock happens once, wherever it is due first.
/xshop stock ores diamond set 200     # set it
/xshop stock ores diamond add -50     # add to it, or take away
/xshop stock ores diamond restock     # back to its max

set and add need an amount; restock works alone.

The dashboard's Stock page lists every product that has a stock, with what is left, its max and its next restock, and does the same with Set the stock and Restock.

Limits per Player

iron_ingot:
  buy: 8
  sell: 2
  limit:
    buy: 256          # per player, per period
    sell: 512
    period: daily     # daily, weekly, monthly, forever, or a duration such as 6h
    tiers:
      vip: 512                          # xshop.limit.vip raises the buying limit
      mvp: { buy: 1024, sell: 2048 }    # xshop.limit.mvp raises both
PeriodDescription
dailyFrom one reset-hour to the next
weeklyFrom Monday's reset-hour to the next Monday's
monthlyFrom the reset-hour of the first of the month to the next first
foreverOnce and for all; never, once and lifetime say the same
a duration, 6hA rolling window: opened by the first trade, closed that long after, opened again by the next one
  • buy and sell count units per player per period; 0, or left out, is no limit on that side.
  • A tier is given by xshop.limit.<tier>: the highest limit a player holds applies, and never one lower than the base. A number alone raises the buying limit; a section raises either side.
  • A purchase larger than what is left of the allowance buys what is left, and the product says how many more the player can trade and when that resets.
  • Calendar periods are counted in time-zone (the server's own when empty) and turn over at reset-hour (0 to 23).
  • A player's allowance is decided by the database, like the stock, and holds across a network.
/xshop limits reset Steve                 # everything Steve used of his limits
/xshop limits reset Steve ores diamond    # one product only

A Rotating Shop

title: "<gold>Daily deals"
icon: NETHER_STAR
rotation:
  offers: 5         # products on offer at a time
  every: 1d         # how long the offers last
  discount: 20%     # off the buy price of what is on offer
  stock: 32         # units of each offer for the period; 0 for no limit
  limit: 4          # units of each offer one player may buy in the period; 0 for no limit
products:
  diamond:
    buy: 80
  enchanted_golden_apple:
    buy: 1500
  totem_of_undying:
    buy: 400

Every period, offers products are drawn from the shop's list, and only those can be traded until the next draw. The draw is worked out from the shop's name, the number of the period and rotation.seed in config.yml: nothing is stored and nothing is sent, so every server with the same file and the same seed shows the same offers at the same moment, and a server that restarts finds the offers it had. Changing the seed changes the draws.

  • Periods turn over at reset-hour, in time-zone: a daily shop changes its offers at the reset hour.
  • rotation.stock gives each offer a fresh stock every period, in place of its own. Without it, a product with a stock of its own keeps it, restocks included.
  • rotation.limit gives each offer a fresh limit per player every period, for the offers that have no limit of their own. A product's own limit wins: a rank sold once and for all stays once and for all, whatever the draw.
  • The discount multiplies with the other modifiers and, like a sale, goes no deeper than the item's ceiling.
  • The list of shops and the shop's info item say when the offers change, and so does %xshop_rotation_<shop>%. enabled: false turns the rotation off.

The starter deals.yml is one: five rare items a day out of twenty, a fifth off, 32 of each for the day and 4 per player.