Chest Settings Documentation
The ChestSettings.yml file is the heart of the plugin’s configuration. It controls how items are chosen and placed into chests across your server. The plugin uses a weight-based random selection system to fill empty chest slots and supports two configuration styles:
- Legacy Format: A compact format that simply defines a material, weight, and maximum amount.
- New Expanded Format: A more advanced format that lets you specify custom names (with Minecraft color codes), an item‑wide level display mode, and a list of enchantments (with customizable levels and lore colors).
This documentation covers every aspect of the configuration—from the basic mechanics to advanced customization options—and provides links to external resources so you can learn more about the valid IDs and properties.
1. How the Plugin Works
A. Overview of the Process
Chest Detection:
When the plugin is triggered (for example, when a chest is generated), it first determines which chest configuration to use:- The chest’s block is examined and its biome is identified.
- The plugin then checks each chest configuration (found under
ChestSettings
) to see if the chest’s biome is listed in its Biomes section.
For a complete list of valid biome names, see the Bukkit Biome documentation.
Item Selection:
- The plugin scans the chest’s inventory for empty slots.
- For each empty slot, it uses a weighted random selection:
- Weight: Each item’s weight determines how likely it is to be chosen relative to the others.
- MaxAmount: An item is only added until its configured maximum number is reached.
- A random quantity (from 1 up to the remaining allowed amount) is selected and the item is placed in that slot.
Item Customization:
- Custom Names:
Items may have a custom display name with Minecraft color codes (see section 3). - Enchantments:
If enchantments are defined, each empty slot may have enchantments applied to the item based on their individual weight and level ranges. - Item-wide LevelType:
A singleLevelType
(defined at the item level) sets how all enchantments on that item are displayed:- Standard: Enchantment levels are displayed as numbers prefixed with
lvl_
(e.g.,"lvl_1"
). - Roman: Enchantment levels are displayed as Roman numerals (e.g.,
"I"
), but only supports values up to 3999. - If no LevelType is specified, the plugin defaults to Roman.
- Standard: Enchantment levels are displayed as numbers prefixed with
- Custom Names:
B. How Weight and Probability Work
Relative Likelihood:
Each item’s weight is used to calculate its probability of being chosen relative to the total weight of all items. For example, if one item has a weight of 10 and another a weight of 20, the second is twice as likely to be selected.Probability Calculation:
The chance of an item being selected is calculated as:itemProbability = (itemWeight / totalWeight)
This system makes it easy to adjust the chances of items appearing by simply changing their weight values.
2. YAML Formatting Options
The plugin supports two configuration styles: the Legacy Format and the New Expanded Format.
A. Legacy Format
This simple format defines items as strings with the syntax:
MATERIAL_NAME:weight:maxAmount
- Material Name: Must match a valid Bukkit Material. See the Bukkit Material documentation for details.
- Weight: A numeric value representing how likely this item is to be selected.
- MaxAmount: The maximum number of this item that can appear in a chest.
Example:
ChestSettings:
Chest1:
Items:
- MYCELIUM:30:5
- RED_MUSHROOM:20:5
- BROWN_MUSHROOM:20:5
Biomes:
- MUSHROOM_FIELDS
B. New Expanded Format
This format uses a nested structure to provide advanced customization.
Item Properties
For each item (using the material name as the key), you can specify a list of properties:
Weight: (required)
The relative likelihood that this item will be selected.MaxAmount: (required)
The maximum number of this item that can appear in a chest.CustomName: (optional)
A custom display name for the item. Minecraft color codes are supported.
Example:CustomName: §6HolyDirt
This displays “HolyDirt” in gold.
LevelType: (optional, item‑wide)
Sets how enchantment levels on the item are displayed:- Standard: Displays as numbers with the prefix
lvl_
(e.g.,"lvl_1"
). - Roman: Displays as Roman numerals (e.g.,
"I"
).
Roman numeral conversion supports values only up to 3999. - Default: If omitted or unrecognized, it defaults to Roman.
- Standard: Displays as numbers with the prefix
Enchantments: (optional)
A list of enchantment definitions. Each enchantment is defined as a map:- Header:
The enchantment name (must match a valid Bukkit Enchantment). See the Bukkit Enchantment documentation. - Properties: (as a list)
- Weight:
A chance (in percent) that the enchantment is applied. - MinLevel:
The minimum level (inclusive) to be chosen. - MaxLevel:
The maximum level (inclusive) to be chosen. - LoreColor: (optional)
The color for displaying this enchantment in the item’s lore. If omitted, defaults toGRAY
.
- Weight:
- Header:
Example:
ChestSettings:
Chest1:
Items:
- MYCELIUM:
- Weight: 30
- MaxAmount: 5
- CustomName: §6HolyDirt
- LevelType: Standard
- Enchantments:
- FORTUNE:
- Weight: 100
- MinLevel: 1
- MaxLevel: 4
- LoreColor: RED
- LOOTING:
- Weight: 30
- MinLevel: 0
- MaxLevel: 3
- LoreColor: BLUE
- RED_MUSHROOM:
- Weight: 20
- MaxAmount: 5
- BROWN_MUSHROOM:
- Weight: 20
- MaxAmount: 5
- RED_MUSHROOM_BLOCK:
- Weight: 10
- MaxAmount: 5
- BROWN_MUSHROOM_BLOCK:
- Weight: 10
- MaxAmount: 5
- MUSHROOM_STEM:
- Weight: 10
- MaxAmount: 5
Biomes:
- MUSHROOM_FIELDS
In this configuration:
- The item
MYCELIUM
uses the Standard level type—meaning every enchantment on this item will display levels as"lvl_1"
,"lvl_2"
, etc. - The
FORTUNE
enchantment is set to use a lore color ofRED
, whileLOOTING
usesBLUE
.
3. Minecraft Color Codes
A. Custom Item Names (Titles)
When setting a custom name via CustomName
, you can include Minecraft color codes using the section sign (§
). Below is a table of available color codes:
Color Name | Minecraft Code | Example Usage |
---|---|---|
BLACK | §0 | §0Black |
DARK_BLUE | §1 | §1Dark Blue |
DARK_GREEN | §2 | §2Dark Green |
DARK_AQUA | §3 | §3Dark Aqua |
DARK_RED | §4 | §4Dark Red |
DARK_PURPLE | §5 | §5Dark Purple |
GOLD | §6 | §6Gold |
GRAY | §7 | §7Gray |
DARK_GRAY | §8 | §8Dark Gray |
BLUE | §9 | §9Blue |
GREEN | §a | §aGreen |
AQUA | §b | §bAqua |
RED | §c | §cRed |
LIGHT_PURPLE | §d | §dLight Purple |
YELLOW | §e | §eYellow |
WHITE | §f | §fWhite |
B. Enchantment Lore Colors
For each enchantment’s LoreColor
, you can use any of the above color names (e.g., RED
, BLUE
, GREEN
). If an invalid or unrecognized color is provided, it will default to GRAY
.
4. LevelType: Standard vs. Roman
The LevelType setting, defined at the item level, controls how enchantment levels are displayed in the item’s lore.
Standard Level Type:
- Display Format:
Enchantment levels are shown as a numeric value prefixed withlvl_
.
Example:"Mending lvl_1"
,"Fortune lvl_2"
- When to Use:
- Recommended if you have enchantments with very high levels (greater than 3999), as Roman numeral conversion is limited to 3999.
- Also ideal if you prefer a straightforward numeric display.
Roman Level Type:
- Display Format:
Enchantment levels are converted to Roman numerals.
Example:"Mending I"
,"Fortune II"
- Limitation:
Supports levels only up to 3999. - Default Behavior:
If noLevelType
is provided or if an invalid value is used, the plugin defaults to Roman.
5. Advanced Weighting: Filler Items & Rare Items
The weight-based system allows you to fine-tune the odds of specific items appearing in a chest. This is particularly useful for making rare items even rarer.
Using Filler Items
Concept:
Filler items, such asAIR
or another common block, can be added with a very high weight to represent empty or “no loot” outcomes. This dilutes the selection pool, making it less likely for any rare or valuable item to be chosen.Example Configuration:
To make diamonds extremely rare, you could configure:- AIR: with a weight of 90
- DIAMOND: with a weight of 0.3
If the total weight is approximately 90.3, the chance of a diamond being chosen is roughly 0.3/90.3, which is less than 0.33%.
Practical Tips
Balancing the Odds:
Use filler items to “dilute” the overall pool. This ensures that high-value items (with low weights) are chosen only rarely.Testing and Tuning:
Experiment with different weight values over several chest generations to achieve your desired loot balance.Thematic Uses:
Filler items can also contribute to your server’s theme by, for example, using a block with a custom name like “Nothingness” to indicate emptiness.
6. Additional Resources and References
For further details, refer to these resources:
Bukkit Materials:
Bukkit Material documentationBukkit Enchantments:
Bukkit Enchantment documentationBukkit Biomes:
Bukkit Biome documentationMinecraft Color Codes:
Minecraft Wiki on Formatting Codes
7. Summary
- ChestSettings.yml defines how chests are populated via a weight-based system.
- Configuration Formats:
- Legacy Format: Simple
MATERIAL:WEIGHT:MAXAMOUNT
strings. - New Expanded Format: Detailed nested configuration allowing for:
- Custom Item Names: With support for Minecraft color codes.
- Item-wide LevelType: Controls how enchantment levels are displayed:
- Standard:
"lvl_x"
(good for high values) - Roman: Roman numerals (up to 3999; default)
- Standard:
- Enchantments: With properties for weight, level ranges, and individual
LoreColor
.
- Legacy Format: Simple
- Weight-Based Selection:
The chance of an item being selected is calculated using its weight relative to the total weight. - Filler Items:
Add items likeAIR
with high weights to reduce the likelihood of rare items (e.g., DIAMOND with a very low weight) appearing. - Customization and Fine-Tuning:
Use the provided configuration options to tailor loot tables to your server’s needs. - Resources:
Links to Bukkit documentation and the Minecraft Wiki are provided for more information on valid IDs and color codes.
This comprehensive guide covers all aspects of the plugin’s functionality—from the basic legacy configuration to advanced features like filler items and detailed loot odds customization. With detailed examples, resource links, and clear explanations for each option, this document should help even beginners fully understand and utilize the plugin. Happy configuring!