Costs

Overview

It is possible to define a cost that players must pay to create tunnels. If players have the portablehole.cost.exempt permission node (by default only ops have this), then costs will not be levied.

Default Costs

There is a default list of tunnelling costs in config.yml - these costs are checked in order and the first cost that the player can afford will be charged when they try to create a tunnel. This is the default (which you probably want to modify to suit your server's needs):

costs:
- cost: REDSTONE
  blocks: 20
- cost: COAL
  blocks: 10
- cost: E,1
- cost: DIAMOND_PICKAXE,1,D
- cost: H,1

What does this mean?

  • Charging one piece of redstone allows tunnelling through 20 blocks.
  • If the player has no redstone, then charging one piece of coal allows tunnelling through 10 blocks.
  • If the player has no coal, then one economy credit (E,1) allows tunnelling through 1 block.
  • If the player has no money, then applying one durability damage to a diamond pickaxe (DIAMOND_PICKAXE,1,D) in the player's inventory allows tunnelling through 1 block.
  • Finally, if the player doesn't have a diamond pickaxe, then tunnelling is allowed at the cost of 1 health (H,1)

These costs are checked in order, and the first affordable cost is applied, and processing of the cost list ends. So the player will pay at most one of the above costs.

Note that each list element includes a mandatory "cost" part, and an optional "blocks" part. "blocks" defaults to 1 if omitted.

Cost Types

Here are the available cost types:

TypeSyntaxExampleMeaning
Items<item-id-or-name>[,<count>]REDSTONE

3,2
1 redstone

2 dirt
Item Durability<item-id-or-name>,<count>,DDIAMOND_PICKAXE,1,D1 damage to a diamond pickaxe
HealthH,<count>H,11 health (half a heart)
HungerF,<count>F,11 food level
ExperienceX,<count>X,55 xp
MoneyE,<count>E,11 economy credit

Tunnelling Credits

Note that some of the above costs allow digging multiple blocks. In this case, any unused credit stays with the player and will be checked the next time they try to create a tunnel. Best explained by example (using the default costs above):

  • Player has 20 redstone and tries to create a hole 5 blocks long.
  • This succeeds - one redstone is charged and player gets 20 blocks of credit.
  • The hole is created and 5 credits are taken (hole is 5 blocks), leaving Player with 15 credits.
  • Player now tries to create a tunnel 10 blocks long.
  • This succeeds, and no cost is applied because Player still had 15 credits. Player is left with 15 - 10 = 5 credits.
  • Player now tries to create a tunnel 18 blocks long.
  • Player only has 5 credits, i.e. a shortfall of 13. So another piece of redstone is charged, giving the player 20 more credits.
  • Player now has 25 credits, of which 18 are taken to create the hole, leaving him with 7 credits.

This all looks complex, but is pretty transparent to players, who just need to know what resources they must have to be able to create holes. Players can always check how many tunnelling credits they have by typing /ph info.

Examples

costs:
- cost: GOLD_PICKAXE,1,D
  blocks: 1

Only one cost is defined here, so players must have a gold pickaxe on them, and one durability is taken from it per length of hole created.

costs:
- cost: E,1
  blocks: 5
- cost: X,10
  blocks: 20

Here, one economy credit is taken to give five blocks of credit. If the player has no money, then 10 experience is charged to give 20 blocks of credit. Note that money is always checked first, and experience will only be taken if the player doesn't have enough money.

costs:

Trivial case: no costs are defined, so all tunnelling is free!


Comments

Posts Quoted:
Reply
Clear All Quotes