Builder wands
How the line is worked out, where the blocks come from in each mode, and every key that changes the result.
A builder wand extends the block you clicked, in the direction of the face you clicked, up to the line length set on the wand. There are two modes and they differ in one thing only: where the blocks come from.
| Type | Where the blocks come from |
|---|---|
build-inventory | The player's own inventory |
build-shop | Bought from your shop at the buy price |
Both can also draw from an InfiniteBags bag, see Bag mode.
This is not a WorldEdit add-on. The line logic is inside the plugin and WorldEdit is never involved.
How the line is worked out
Check the clicked block
The material you clicked has to pass the wand's whitelist and blacklist. If it does not, nothing happens and the player is told.
Walk out from the clicked face
The wand steps out one block at a time, up to length steps, in the direction of the face that was clicked. Click the top of a block and the line goes up.
Keep only the positions it may fill
A position is kept when it is inside the world's build limits and the block already there is on the replaceable list in config.yml.
Place, one block at a time
Each block copies the clicked block's own block data, so stairs, logs and slabs come out facing the same way. Every single placement fires a normal BlockPlaceEvent.
An obstruction is skipped, not treated as the end of the line. If the third position along is solid stone, the wand places positions one, two, four and five and steps over the third. Same for a position a protection plugin refuses.
The default replaceable list is deliberately small:
replaceable:
- AIR
- CAVE_AIR
- SHORT_GRASS
- TALL_GRASS
- SNOWAnything not on that list is never overwritten. Add to it if you want the wand replacing water or leaves.
Protection plugins still win
Every block fires a real BlockPlaceEvent before it counts. WorldGuard, Lands, GriefPrevention, Towny and the rest see it and can cancel it. A cancelled block is put straight back and skipped, and the rest of the line still goes down. The player is charged for nothing they did not get.
Where the blocks come from
The blocks come out of the player's inventory, and the wand places as many as they actually have. Run out halfway and the line stops there, with a message saying that is all they had.
With bag use on, the bag joins in as a second source. Which one is tried first is set by building.source-order in config.yml:
building:
# inventory or bag
source-order: inventoryThe off hand and armour slots are not counted or touched.
Uses
uses-mode decides what one click costs.
| Value | One click costs |
|---|---|
per-click | uses-per-action, whatever the line turns out to be |
per-block | One use for every block that actually goes down |
In per-block mode the line is also cut short by what is left. A wand with three uses left places three blocks, not five, and does not go into debt.
Nothing is charged for a click that places nothing.
Keys on a builder wand
| Key | What it does | Default |
|---|---|---|
type | build-inventory or build-shop | none |
length | How many blocks one click reaches for | 5 |
uses | Uses a fresh wand starts with | 0 |
uses-mode | per-click or per-block | per-click |
uses-per-action | Uses one click costs in per-click mode | 1 |
on-empty | break or keep at zero uses | break |
bag-default | Bag use state a fresh wand starts on | false |
cooldown | Seconds between uses, per player | 0 |
whitelist | Only these materials can be extended. Empty means everything | empty |
blacklist | These materials can never be extended | empty |
sound | Played on a successful click | none |
boost, minimum-value, maximum-value, show-item-count and show-boost do nothing on a builder wand. They are sell keys.
Example
wands:
builder:
type: build-inventory
item:
material: BREEZE_ROD
name: "&bBuilding Staff"
custom-model-data: 1002
glow: true
durability-bar: false
flags:
- HIDE_ATTRIBUTES
- HIDE_ENCHANTS
lore:
- "&7Right-click a block to extend it."
- "&7Sneak and right-click to switch bag use."
- ""
- "&fBlocks per click: &b{length}"
- "&fBag use: &b{bag}"
- "&fUses left: &b{uses}"
uses: 250
uses-mode: per-click
on-empty: break
length: 5
bag-default: false
permission: wandworks.use.builder
cooldown: 0
sound: BLOCK_STONE_PLACE
whitelist: []
blacklist:
- BEDROCKTurning that into a shop mode wand is a one word change to type: build-shop. The example file ships with both.
When it refuses
| What the player sees | Why |
|---|---|
| This wand is not allowed to place that block | The clicked material failed the whitelist or blacklist |
| There was no room to place anything | Every position along the line was solid or outside the build limits |
| You do not have any of that block | Inventory mode, and the player has none, and the bag has none either |
| X has no buy price, so it was skipped | Shop mode, and no price source has a buy price for that block |
| You cannot afford even one block | Shop mode, and the balance will not cover one |
| This wand is off because no economy plugin was found | Shop mode with no Vault economy installed |
| Placed N blocks, that is all you had | The line ran longer than the player's stock |
| Placed N blocks for X, that is all you could afford | The line ran longer than the player's balance |