Skip to content

Config file

Władysław Nowak edited this page May 14, 2021 · 17 revisions

All about config.yml

Sections

Introduction

The configuration of this plugin is written in the config.yml file, which according to Wikipedia is a human-readable data serialization language. In this language/file indents are important (usually its 2 spaces or tab). Every indent represents a new section/subsection. To add a comment you simply write # before the text - it won't be read by the computer. It's really simple and easy to understand by us, humans.

Adding new material to the drop list

To add a new material you have to find chances: section. Usually it is somewhere in the beginning of the file. After you've found it you have to go to a new line and make an indent. Now add item that you want to be dropped like this:

  MATERIAL_NAME:
    fortune-0:
      chance: <FLOATING_POINT_NUMBER>
      max-amount: <INTEGER_NUMBER>
      min-amount: <INTEGER_NUMBER>
    fortune-1:
      chance: <FLOATING_POINT_NUMBER>
      max-amount: <INTEGER_NUMBER>
      min-amount: <INTEGER_NUMBER>
    fortune-2:
      chance: <FLOATING_POINT_NUMBER>
      max-amount: <INTEGER_NUMBER>
      min-amount: <INTEGER_NUMBER>
    fortune-3:
      chance: <FLOATING_POINT_NUMBER>
      max-amount: <INTEGER_NUMBER>
      min-amount: <INTEGER_NUMBER>
# The following lines are optional
    enchant:
        ENCHANT_NAME: <ENCHANT_LEVEL>
    minLevel: <INTEGER> # This is optional. Sets minimal Y level the item can be dropped on.
    maxLevel: <INTEGER> # Also optional, but if minLevel is specified, then required. Sets maximal Y level the item can be dropped on
    customName: "&2Example item name coloured green" # Optional, used to set the custom name of dropped item.

Where MATERIAL_NAME is a Minecraft material specified on this webpage and ENCHANT_NAME is an enchant specified here (Usually its the same as the in-game enchant, but sometimes its different - i.e. Fortune is specified as LOOT_BONUS_BLOCKS, so BE AWARE)

Every item section has to include four subsections:

  • fortune-0 - what happens when a player is holding a pickaxe with no fortune on it
  • fortune-1 - what happens when a player is holding a pickaxe enchanted fortune 1
  • fortune-2 - what happens when a player is holding a pickaxe enchanted fortune 2
  • fortune-3 - what happens when a player is holding a pickaxe enchanted fortune 3

Every one of these has to additionally include:

  • chance - a chance of this item dropped specified by a number from 0 to 1 (i.e. chance: 0.2)
  • min-amount - a minimal amount of items to be dropped (i.e. max-amount: 2)
  • max-amount - a maximal amount of items to be dropped (i.e. max-amount: 2)

Adding enchant to your item

Additionally, it is optional to add an enchant for the item. To do this, in the MATERIAL_NAME subsection you have to add something like this:

    enchant:
      ENCHANT_NAME: <enchant level>

Add item drop on specific Y levels

This is a recently added feature, so if you encounter any errors please let us know!

This plugin also supports item drop on specific Y levels. What it means is that server administrator can set any item to be dropped only on a range of Y levels, for example, a diamond can be only found on levels Y: <0, 25>. To do that, a server owner or admin has to add two new properties to the item in config.yml file - minLevel and maxLevel, those two parameters define in what range the item can be dropped. Please remember, that those parameters have to be indented only by one level after the item name, as shown in the example.

chances:
  DIAMOND:
    minLevel: 0
    maxLevel: 25
    fortune-0:
      chance: 0.0025
      max-amount: 1
      min-amount: 1
    fortune-1:
      chance: 0.0025
      max-amount: 2
      min-amount: 1
    fortune-2:
      chance: 0.003
      max-amount: 3
      min-amount: 2
    fortune-3:
      chance: 0.00325
      max-amount: 4
      min-amount: 3

This configuration defines a drop of a diamond only on a Y level range from 0 to 25.

Adding a custom name to an item

It is also possible to set the custom name of the item dropped. To do that, all that is required is one additional parameter: customName followed by item name. Example:

chances:
  DIAMOND:
    customName: "&2This is a custom name coloured green"
    fortune-0:
      chance: 0.0025
      max-amount: 1
      min-amount: 1
    fortune-1:
      chance: 0.0025
      max-amount: 2
      min-amount: 1
    fortune-2:
      chance: 0.003
      max-amount: 3
      min-amount: 2
    fortune-3:
      chance: 0.00325
      max-amount: 4
      min-amount: 3

That configuration defines a diamond to be dropped with custom name This is a custom name coloured green.

Adding command execution

Since version 1.9.6 of the plugin you can add a chance of command execution while mining stone! To do that simply find executeCommands section in config and in the new line indented with 2 spaces add command quoted command with chance after colon. Use @player for a player name. See example below.

#List of commands that could be executed (use @name for player name)
#In this example: 10% chance of executing command give on player.
executeCommands:
  "give @player golden_apple 20": 0.1

Set drop from ores

This toggles a drop of normal, vanilla items from ores. Can be helpful against the cheaters.

ore-drop: true

Ore whitelist

This option can be used when you want to override ore drop for specific ores.

#If ore-drop is False, some specific ores can drop anyway. This is white list drop ores.
#If there is no, type []
ores-whitelist:
  - COAL_ORE
  - REDSTONE_ORE
  - GLOWING_REDSTONE_ORE

Configuring mystery chest

To change the chance of the mystery chest appearing while mining change chest-spawn-chance: to your preferences. Example:

chest-spawn-chance: 5.0E-6 #It's also allowed to use normal floating-point numbers - not scientific

Next up is configuring the contents of the mystery chest. It is specified in the chest: subsection. It's similar to the previous one, but a little bit different. This is a general template:

chest:
  MATERIAL_NAME:
    chance: <FLOATING_POINT_NUMBER>
    min: <INTEGER_NUMBER>
    max: <INTEGER_NUMBER>
# The following lines are optional - if the item has to be enchanted
  enchant:
    enchant_name: <ENCHANT_LEVEL>

As in previous example the MATERIAL_NAME is one listed on this webpage and enchant_name is one listed here

The rest of the configuration

In this config file you can also configure:

  • From what blocks should the items be dropped
  • How many experience should be dropped from blocks
  • If the ores should drop items or not
  • Should items be added directly to a player's inventory
  • Toggle displaying of update message on join
  • Set disabled worlds

Configuring from which blocks should the items be dropped

It can be configured by listing the blocks with "-" before in dropBlocks subsection. Example

dropBlocks:
  - STONE
  - ANDESITE
  - GRANITE

Amount of experience dropped

Experience dropped is calculated accordingly to the player's current experience nonetheless, it is advised to set this value below 1.0, like 0.3. This line should be set to the desired value:

experience: 3.0

Choose xp or xp orbs

Set to "drop-exp-orb:true" if u want to repair mending tools or to false to get xp directly to your xp bar

drop-exp-orb: true

Adding disabled worlds

Similarly to drop blocks:

disabled-worlds:
  - world_nether
  - some_random_world_name

If the items should be dropped directly to the player's inventory

drop-to-inventory: false # Or true

Toggle displaying update message

display-update-message: true # Or false

Set treasure chest drop directly to inventory

You can globally set to have treasure contents dropped directly into players inventory instead of spawning the chest. Just change this line:

drop-chest-to-inventory-global: false

This option works globally meaning it won't be affected by any permission. If you want only chosen players to use this option then leave this line set to false and give stonedrop.chest.to-inventory permission to those players.

Change volume

Must be a value between 0.0 and 1.0

volume: 0.3

Broadcasting a message when a player finds treasure chest

treasure-broadcast: true

Realistic drop

If you want to have items spawned more naturally (like if you destroyed the chest) then this option might be very helpful

#realistic multi direction drop spread
realistic-drop: true

Example basic item configuration

chances:
  DIAMOND:
    fortune-0:
      chance: 0.0025
      max-amount: 1
      min-amount: 1
    fortune-1:
      chance: 0.0025
      max-amount: 2
      min-amount: 1
    fortune-2:
      chance: 0.003
      max-amount: 3
      min-amount: 2
    fortune-3:
      chance: 0.00325
      max-amount: 4
      min-amount: 3

Example full item configuration

  DIAMOND_PICKAXE:
    minLevel: 0   #Min Y level to drop this item
    maxLevel: 256 #Max Y level to drop this item
    customName: "&b&lCustom named item!"
    fortune-0:
      chance: 0.002
      max-amount: 1
      min-amount: 1
    fortune-1:
      chance: 0.003
      max-amount: 1
      min-amount: 1
    fortune-2:
      chance: 0.004
      max-amount: 1
      min-amount: 1
    fortune-3:
      chance: 0.005
      max-amount: 1
      min-amount: 1
    silk_touch-1:
      chance: 0.1
      max-amount: 1
      min-amount: 1
    enchant:      #List of all enchantments that should be applied
      silk_touch: 1
    biomes:       #Drop only on following biomes
      - Mountains

Example config.yml file

An example config file can be found on this project's repository - here - the latest version of config.yml file