Creating Custom Items
Learn how to create custom items from YAML configuration using the ItemBuilder class with support for placeholders, mathematical expressions, display conditions, custom commands, and NBT data.
Table of Contents
Basic Usage
Creating a Simple Item
import me.yleoft.zAPI.item.ItemBuilder;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class Example {
public ItemStack createCustomItem(Player player, YamlConfiguration config) {
// Create item from config at path "items.my_item"
return ItemBuilder.createItem(player, config, "items.my_item");
}
}With Custom Placeholders
Creating Items from Config
Method Signatures
Configuration Path
Item Properties
Configuration Keys
Key
Type
Description
Material Types
Standard Materials
Random Selection
Player Heads
Display Name and Lore
Enchantments
Item Flags
Commands
Pickable Property
Placeholder System
Built-in Placeholders
Placeholder
Description
Example
Creating Slot Placeholders
Custom Placeholders in Config
Placeholder Processing Order
Merging Placeholder Maps
Mathematical Expressions
Basic Operations
With Placeholders
Supported Functions
Function
Description
Example
Complex Expressions
Format of Results
Display Conditions
Evaluating Conditions
Condition Syntax
Comparison Operators
Operator
Description
Example
Basic Conditions
With Math Expressions
In Configuration
Advanced Features
Parsing Placeholder Definitions
Replacing Placeholders in Existing Items
Creating Items from Material Strings
Parsing Material Names
Complete Examples
Example 1: Dynamic Weapon
Example 2: Multi-Slot Home Items
Example 3: Conditional Shop Item
Example 4: Skill Tree Item
Best Practices
Performance Tips
Troubleshooting
Item Not Created
Placeholders Not Replacing
Math Not Evaluating
Commands Not Executing
See Also
Last updated
Was this helpful?
