WandWorks

Sell wand

How a sell wand values a container, what it leaves behind, and every key that changes the payout.

A sell wand turns a full chest into money in one click. The player right-clicks a container, the wand prices everything inside, pays them, and empties only the slots it actually sold.

Set it up with type: sell in wands.yml.

How a sale is worked out

A worked example. Stone and dirt are priced and sold, blacklisted and unpriced stacks are left in the chest, the total is multiplied by the wand boost and checked against the minimum and the cap

Group the contents

Identical stacks are grouped together, matching on the full item including name, enchantments and everything else. A double chest full of stone is one group, not thirty six.

Price each group once

Each group gets one price lookup, for a single item, and the answer is multiplied by how many there are. This is why a full double chest costs one lookup per item type instead of one per slot. Where the price comes from is set by prices.order.

Add it up and apply the boost

The priced total is multiplied by the wand's boost, then rounded to two decimals.

Check the minimum and the cap

Below minimum-value the sale is refused and nothing is taken. Above maximum-value the payout is capped and the player is told.

Pay, then empty the sold slots

The money goes in first. Only then are the sold slots cleared, and only the sold ones.

What gets left behind

Three things stay in the container:

  • Anything on the wand's blacklist.
  • Anything not on the wand's whitelist, when that list is not empty.
  • Anything no price source has a price for.

An item nobody prices is treated as having no price, never as being worth zero. Zero would read as a free item and the wand would take it for nothing.

Setting selling.cancel-on-unpriced: true in config.yml changes the third case. Instead of skipping the unpriced item, the whole sale stops and the player is told which item blocked it.

Which containers work

Only the blocks listed under containers in config.yml:

containers:
  - CHEST
  - TRAPPED_CHEST
  - BARREL
  - SHULKER_BOX

Two things worth knowing:

  • A double chest counts as one container. Clicking either half sells the whole thing.
  • SHULKER_BOX covers the coloured ones. You do not need sixteen more lines for the dyed variants.

Right-clicking a block that is not in the list does nothing at all. The wand stays out of the way, no message, no cancelled interaction, so players can still open chests normally with the wand in hand if you take chests off the list.

Keys on a sell wand

KeyWhat it doesDefault
typeMust be sellnone
boostMultiplies the priced total1.0
minimum-valueSales worth less than this are refused0.0
maximum-valueHighest payout one sale can give. 0 turns the cap off0.0
usesUses a fresh wand starts with0
uses-per-actionUses one sale costs1
on-emptybreak or keep at zero usesbreak
cooldownSeconds between uses, per player0
whitelistOnly these materials are sold. Empty means everythingempty
blacklistThese materials are never soldempty
soundPlayed on a successful salenone
show-item-countPuts the item count in the messagetrue
show-boostPuts the boost in the messagetrue

Everything under item (material, name, lore, glow, model data, flags, durability bar) is shared with the other types and is covered on Defining wands.

uses-mode, length and bag-default do nothing on a sell wand. They are builder keys.

The sale message

show-item-count and show-boost pick which of three messages the player gets.

show-item-countshow-boostMessage used
truetruesell.success-with-boost, count and boost both shown
truefalsesell.success, count shown
falseeithersell.money-only, money only

With show-item-count: false the boost is never shown, whatever show-boost says. Wording for all three lives in your language file, see Messages and language.

The boost stacks

If your shop plugin already gives that player a multiplier through a permission or a rank, the wand boost multiplies on top of it. A 2x rank multiplier and a boost: 1.25 wand pay 2.5x the base price. This is deliberate. Price a wand's boost with that in mind.

Example

wands:
  seller:
    type: sell
    item:
      material: BLAZE_ROD
      name: "&aSelling Staff"
      custom-model-data: 1001
      glow: true
      durability-bar: false
      flags:
        - HIDE_ATTRIBUTES
        - HIDE_ENCHANTS
      lore:
        - "&7Right-click a chest to sell what is inside."
        - ""
        - "&fBoost: &a{boost}x"
        - "&fUses left: &a{uses}"
    uses: 250
    uses-per-action: 1
    on-empty: break
    boost: 1.25
    cooldown: 3
    minimum-value: 1.0
    maximum-value: 0.0
    permission: wandworks.use.seller
    whitelist: []
    blacklist:
      - BEDROCK
    sound: ENTITY_EXPERIENCE_ORB_PICKUP
    show-item-count: true
    show-boost: true

When it refuses

What the player seesWhy
Selling is off because no economy plugin was foundNo Vault economy is installed
There is nothing inside to sellThe container is empty
None of these items have a sell priceEverything inside is blacklisted, off the whitelist, or unpriced
The sale was cancelled because X has no priceselling.cancel-on-unpriced is on and X was unpriced
The contents are worth less than the minimum of XThe boosted total came in under minimum-value
This wand has no uses leftThe wand is empty and on-empty is keep
Wait Ns before using this againThe wand's cooldown has not run out

On this page