Complete guide for Minecraft server administrators to configure and use the zCrates plugin.
Installation
Download the zCrates.jar file
Place it in your server's plugins/ folder
Restart the server
Configuration files will be generated automatically
Requirements
Minecraft: 1.21+
Server: Paper/Purpur
Java: 21+
Dependencies: zMenu (bundled)
Basic Configuration
config.yml
# Enable debug messagesdebug:false# Database configurationdatabase:type:SQLITE# SQLITE, MYSQL, or MARIADBtable-prefix:"zcrates_" # For MySQL/MariaDB onlyhost:"localhost"port:3306database:"minecraft"username:"root"password:""
messages.yml
Customize all plugin messages:
Creating a Crate
Create a file in plugins/zCrates/crates/. Example: legendary.yml
Key Types
Virtual Key (VIRTUAL)
Stored in database, no physical item.
Physical Key (PHYSIC)
Item in player's inventory.
Reward Types
ITEM - Single item
ITEMS - Multiple items
COMMAND - Single command
COMMANDS - Multiple commands
ItemStack Configuration with Delegates
The ItemStackWrapper system allows you to configure items in two ways: direct material specification or delegation to custom item plugins. This is used throughout the plugin for reward items, display items, and physical keys.
Direct Material Specification
Define items using vanilla Minecraft materials:
Delegate System (copy-from)
The delegate system allows you to reference items from custom item plugins using the copy-from parameter. This creates a base item from the plugin, which you can then customize with additional properties.
Structure:
Important Notes:
Either material or copy-from must be specified (not both)
When using copy-from, you can still override display-name, lore, item-name, and amount
The delegate retrieves the base item from the plugin, then applies your customizations
If the item provider returns null, an error will be thrown
Available Delegates
The following custom item plugins are supported through the hook system:
ItemsAdder
Example:
Oraxen
Example:
Nexo
Example:
zItems
When the zItems hook is enabled, it registers itself as an ItemsAdder provider:
Example:
Complete Examples
Physical Key with Delegate
Item Reward with Multiple Customizations
Items List Reward with Mixed Sources
Troubleshooting
"No item provider found for plugin: X"
The hook for that plugin is not enabled
Make sure the target plugin is installed and loaded
Check console logs for hook loading status
"Item provider returned null for itemId: X"
The item ID doesn't exist in the target plugin
Check the spelling and namespace of the item ID
Verify the item exists using the target plugin's commands
Items have wrong properties
Remember that copy-from creates the base item from the plugin first
Your customizations (display-name, lore, etc.) are applied after
Some properties might be overridden by the base item's NBT data
Opening Conditions
PERMISSION
Requires a permission to open the crate.
COOLDOWN
Wait time between openings (in milliseconds).
The cooldown is stored in the player's persistent data container (PDC).
PLACEHOLDER
Checks a PlaceholderAPI placeholder value with flexible comparison types. Requires the PlaceholderAPI hook to be enabled.
Comparison Types:
EQUALS - String or numeric equality
NOT_EQUALS - String or numeric inequality
GREATER_THAN - Numeric comparison (>)
LESS_THAN - Numeric comparison (<)
GREATER_THAN_OR_EQUALS - Numeric comparison (>=)
LESS_THAN_OR_EQUALS - Numeric comparison (<=)
Basic Examples:
Advanced Examples:
Notes:
When using numeric comparisons (GREATER_THAN, LESS_THAN, etc.), the plugin automatically parses both values as numbers
Common formatting characters (commas, spaces) are automatically removed during parsing
If parsing fails for numeric comparisons, the condition returns false
For EQUALS and NOT_EQUALS, if numeric parsing fails, string comparison is used as fallback (case-insensitive)
Combining conditions
Animations
Animations are defined in JavaScript in plugins/zCrates/animations/.
Included Animation: Roulette
File: animations/roulette.js
Creates a classic roulette effect in the menu.
Creating a Custom Animation
Available Speed Curves
LINEAR - Constant speed
EASE_IN - Starts slow, accelerates
EASE_OUT - Starts fast, decelerates
EASE_IN_OUT - Slow → Fast → Slow
Selection Algorithms
Algorithms determine how rewards are selected.
Included Algorithm: Weighted
File: algorithms/weighted.js
Selection based on reward weights.
Creating a Custom Algorithm
Placing Crates
Via Command
Display Types:
Type
Description
Example
BLOCK
Placed block
CHEST, ENDER_CHEST
ENTITY
Spawned entity
ARMOR_STAND, ZOMBIE
MYTHIC_MOB
MythicMobs entity
MyMob
ITEMS_ADDER
ItemsAdder furniture
custom:my_crate
NEXO
Nexo furniture
nexo:crate
ORAXEN
Oraxen furniture
oraxen:crate
Examples
Removing a Placed Crate
Look at the crate and type:
Removing All Crates in a World
Commands
Command
Description
Permission
/zcrates reload
Reload configurations
crates.command.reload
/zcrates open <player> <crate> [force]
Open a crate for a player
crates.command.open
/zcrates give <player> <crate> <amount>
Give keys
crates.command.give
/zcrates place <crate> <type> [value]
Place a crate
crates.command.place
/zcrates remove
Remove a placed crate
crates.command.remove
/zcrates purge
Remove all placed crates
crates.command.purge
/zcrates animations debug
Debug animations
crates.command.animations
Permissions
Command Permissions
crates.command.reload - Access to /zcrates reload
crates.command.open - Access to /zcrates open
crates.command.give - Access to /zcrates give
crates.command.place - Access to /zcrates place
crates.command.remove - Access to /zcrates remove
crates.command.purge - Access to /zcrates purge
crates.command.animations - Access to animation commands
Crate Permissions
Defined in crate conditions:
Hooks & Integrations
PlaceholderAPI
Available placeholders:
Placeholder
Description
%zcrates_keys_<crate-id>%
Number of keys for a crate
%zcrates_openings_<crate-id>%
Total openings count
%zcrates_last_reward_<crate-id>%
Last reward won
MythicMobs
Use MythicMobs mobs as crate displays:
ItemsAdder / Nexo / Oraxen
Use custom furnitures as crates:
FAQ
How do I see a crate's rewards?
Left-click on a placed crate to open the preview.
How does reroll work?
After the animation, if max-rerolls > 0, a reroll button appears. The player can restart the animation for a new reward.
Are virtual keys persisted?
Yes, they are stored in the database (SQLite by default).
How do I give keys via command?
How do I force open without a key?
Why isn't my crate loading?
Check console for errors
Make sure the YAML file is valid
Verify the referenced animation exists
Use /zcrates reload after changes
How do I create a custom menu?
Create a file in plugins/zCrates/inventories/ following the zMenu format. Reference it with related-menu in your crate.
no-key: "<red>You don't have a key for this crate!"
no-permission: "<red>You don't have permission."
condition-no-permission: "<red>You don't have permission to open this crate!"
condition-cooldown: "<red>You must wait <time> before opening this crate again!"
no-rerolls-left: "<red>You have no rerolls remaining!"
reroll-success: "<green>Rerolled! <gray>(<remaining> rerolls left)"
# Unique crate identifier
id: legendary
# Animation to use (see /animations)
animation: roulette
# Reward selection algorithm
algorithm: weighted
# Display name
display-name: "<gold><bold>Legendary Crate"
# Number of rerolls allowed (0 = disabled)
max-rerolls: 3
# Key configuration
key:
type: VIRTUAL # or PHYSIC
name: "legendary-key"
# Associated zMenu menu
related-menu: crate-menu-legendary
# Opening conditions (optional)
conditions:
- type: PERMISSION
permission: "zcrates.open.legendary"
- type: COOLDOWN
cooldown: 3600000 # 1 hour in milliseconds
# Rewards list
rewards:
- type: ITEM
id: diamond-reward
weight: 10.0
display-item:
material: DIAMOND
name: "<aqua>Diamonds"
lore:
- "<gray>5 diamonds"
item:
material: DIAMOND
amount: 5
- type: COMMAND
id: money-reward
weight: 20.0
display-item:
material: GOLD_INGOT
name: "<yellow>$1000"
command: "eco give %player% 1000"
item:
material: DIAMOND_SWORD
amount: 1
display-name: "<gold>Legendary Sword"
item-name: "legendary_sword" # Custom item name (different from display name)
lore:
- "<gray>A powerful weapon"
- "<gray>Forged in fire"
item:
copy-from:
plugin-name: "PluginName" # The plugin providing the item
item-id: "item_identifier" # The item ID in that plugin
amount: 1 # Optional: Override the item amount
display-name: "<gold>Custom" # Optional: Override the display name
item-name: "custom_name" # Optional: Override the item name
lore: # Optional: Override the lore
- "<gray>Custom lore line"
conditions:
# Player must have at least level 10
- type: PLACEHOLDER
placeholder: "%player_level%"
comparison: GREATER_THAN_OR_EQUALS
result: "10"
# Player must have more than $1000
- type: PLACEHOLDER
placeholder: "%vault_eco_balance%"
comparison: GREATER_THAN
result: "1000"
# Player must be in the VIP group
- type: PLACEHOLDER
placeholder: "%vault_group%"
comparison: EQUALS
result: "VIP"
# Player must NOT be in the Banned group
- type: PLACEHOLDER
placeholder: "%vault_group%"
comparison: NOT_EQUALS
result: "Banned"
// algorithms/pity-system.js
algorithms.register("pity-system", function(context) {
var rewards = context.rewards();
var history = context.history();
var crateId = context.crateId();
// Get last 50 openings
var recentOpenings = history.getRecent(50);
// Count openings without rare reward
var openingsWithoutRare = 0;
for (var i = 0; i < recentOpenings.size(); i++) {
var opening = recentOpenings.get(i);
if (opening.crateId() === crateId) {
var reward = rewards.getById(opening.rewardId());
if (reward && reward.weight() > 5.0) {
openingsWithoutRare++;
} else {
break;
}
}
}
// If 50 openings without rare, guarantee one
if (openingsWithoutRare >= 50) {
return rewards.getRare();
}
return rewards.weightedRandom();
});
/zcrates place <crate-id> <display-type> [display-value]
# Chest block crate
/zcrates place legendary BLOCK CHEST
# Armor stand entity crate
/zcrates place legendary ENTITY ARMOR_STAND
# MythicMobs crate
/zcrates place legendary MYTHIC_MOB CrateMob