Skip to content
The Audit

The Audit

What It Is For

A shop that sells oak logs at 8 and buys oak planks back at 3 looks fine line by line. A log makes four planks: 8 in, 12 out, for as long as the player keeps clicking. No rule on a single product catches that, because both prices are reasonable: it takes the recipes.

So, currency by currency, the audit works out the cheapest way to obtain every item: buying it at the lowest price it can ever be bought for, or making it from ingredients obtained the cheapest way, through any chain of recipes. Then it compares that with the most the shop will ever pay for the item. Wherever selling pays more than obtaining costs, there is a loop, and the audit says which purchases and which recipes it goes through.

Purchases are priced at the lowest any known sale can bring them, so a loop that only opens during a sale is found too, before the sale starts.

Running It

/xshop audit

In chat: a header with the number of errors, warnings and notes, then the first twenty findings, the most serious first. The dashboard's Audit page lists them all, each with the icon of its item; it shows the last run, runs one on the first visit, and has a button to run it again.

Each run reads the server's own recipes again, so a datapack or a plugin that adds one is taken into account: crafting, shaped and shapeless, the furnace, blast furnace, smoker and campfire, the stonecutter and the smithing table. Run it after every change of prices.

Audit · 1 error(s) · 0 warning(s) · 0 note(s)
 ✗ Oak Planks: obtained for $2.00 a unit, bought back for $6.00.
   buy 1 Oak Log at $8.00 (wood.oak_log), then make 4 Oak Planks
   (minecraft:oak_planks), then sell 4 Oak Planks at $6.00 (wood.oak_planks)

What It Finds

FindingSeverityDescription
Money loopErrorBuying the ingredients, making the item and selling it pays more than it costs. Close it: see below
UnreadableErrorA shop file that is not YAML at all. Fix the line the finding names
UnreadableWarningA line of a shop file that was left out: an item this server does not know, a price that is not a number, a slot already taken, a sell price above the buy price
Sell price cappedWarningA product buys back for more than the item can be bought for: it pays that much at most. Lower its sell price
No priceWarningA product that can be neither bought nor sold. Give it a price, or remove it
Range cappedNoteAt the top of its dynamic range, a product would buy back above the lowest the item sells for; it is held there. Nothing to fix
Sold twiceNoteThe same item is sold in several products at different prices: everyone buys it at the cheapest
Sale limitedNoteA sale running now could not go as deep as asked on some products, so that buying during it never beats selling after it

Reading a Loop

Oak Planks: obtained for $2.00 a unit, bought back for $6.00. Then the route, step by step:

  • Obtained for: what one unit costs by the cheapest way found, every purchase at the lowest price it can reach: the bottom of a dynamic range, the deepest price group discount, the deepest sale running or scheduled in config.yml, the boosters running and the discount of a rotating shop, never under the item's ceiling
  • Bought back for: the most one unit can ever be sold for, every bonus at max-sell-multiplier. With the default 2.0, planks bought back at 3 can pay 6
  • buy: what to buy, how many, at what price, and from which product (shop.product)
  • make: each recipe, by its key, in the order it is done
  • sell: what is sold back, and to which product
  • (plus the fuel): the route goes through a furnace, whose fuel is not counted. The margin is smaller than it reads, but the loop is there

The quantities are those of one run of the last recipe, so they are whole numbers. What an ingredient leaves behind is counted back: a milk bucket costs its price less what the shop pays for the bucket. A recipe slot that takes several items, any planks, is filled with the cheapest.

Left out of the search: recipes whose result has a name or data, slots that want one particular item, and products that are not plain items (exact items, spawners, commands).

Closing a Loop

A loop closes once the most the shop pays for the item is less than what it costs to obtain. Any one of these does it:

  1. Lower the sell price of the product the last step sells to.
  2. Raise the buy price of what the first steps buy, or stop selling it.
  3. Stop buying the item back.

Then run the audit again: a price changed for one loop can open another further down a chain. Two settings move every number at once: a lower max-sell-multiplier lowers every "bought back for", and a deeper price group discount, or a deeper sale, lowers every "obtained for".

The starter shops keep clear of loops with one rule: a crafted item costs a little more than its ingredients, and everything is bought back for a quarter of its price.