August 27, 2026 · The Minely team
How to make a crates plugin with AI (keys, animations, weighted loot)
Crates are casino design for Minecraft: a key, an animation, and a weighted table of rewards. Players love the spin; server owners love the sink. The engineering is mostly honesty — weights that add up, animations that cannot be exploited, and admin commands that make rewards a config decision rather than a code change.
What a crates plugin actually is
A crates plugin gives players keys that open crate blocks for random rewards. Each crate type has a weighted loot table in config, a spin animation that builds suspense, and a final reward that lands in the inventory with a broadcast for the rare tiers. It is a loop players repeat daily, which makes it the perfect engagement and monetization feature.
How it works under the hood
The spin is a GUI animation: a row of reward icons cycles quickly, slows down, and stops on the server-chosen result — chosen by weight before the animation starts, so the spin is presentation, not probability. Keys are items with a PDC tag marking their crate type. The crate block (an ender chest is the classic) checks the key on interact, consumes it, runs the spin, and pays out. Rarity tiers (common, rare, epic, legendary) get their own weights and broadcast rules.
The prompt that builds it
You do not have to write this yourself. A precise description is enough:
a crates plugin with keys, a spinning GUI animation, weighted rewards in config.yml, rarity tiers, a /crate givekey admin command, and a broadcast for legendary wins
Name the commands, the permissions, and the exact messages players see. Precision here is what makes the first build land close.
Building it in the right order
- Define the crate type and its weighted reward table in config.
- Implement keys with PDC tags and the crate block interaction.
- Build the spin animation with the pre-chosen result.
- Add the payout, inventory-full handling, and rarity broadcasts.
- Create admin commands for keys, tables, and test spins.
The details that matter in production
In production, the first thing you learn is that the happy path is the easy half. The edges are where the work lives: restarts, protection interactions, full inventories, and players who treat every system like an exploit puzzle. Build for those from day one and the launch weekend is quiet instead of a fire drill.
Storage and cleanup deserve special attention. Write state as it changes rather than on shutdown, clear per-player state on quit and on world change, and make every admin-facing action leave an audit line. The first time something goes wrong, those records are the difference between a two-minute review and an evening of guessing.
Finally, test like a hostile user. Spam-click every GUI, rejoin mid-action, try the command with no permission and with every permission, and run it while the server is under load. The bugs that survive that pass are the ones worth shipping.
Tuning it after the first build
Weights should be honest and visible: common 60 to 70 percent, rare 20 to 25, epic 6 to 10, legendary 1 to 3. Players forgive low odds they can see. Sell keys for real value (votes, shop money, playtime) before monetizing them — a crate that feels earned outperforms a crate that feels bought.
Tips that save you a rebuild
- Choose the reward by weight before the animation; never let the animation decide.
- Handle a full inventory gracefully — drop at feet or hold for later, never void.
- Test the weights with a dry-run command that reports simulated odds.
- Cap spins per second so click spam cannot race the animation.
Questions people ask
Can I have multiple crate types?
Yes — each crate type gets its own key tag, block, and table. Ask for a vote crate and a legendary crate as separate types.
How do I prove the odds to players?
Publish the weights in the GUI as percentages — transparency converts skeptics.
What about physical key items?
Keys are real items with a PDC tag, so they can be traded, sold, or stored safely.
Try the prompt above on a fresh project. You will see the plan, the code streaming in, and the repair loop finish the job — then a jar to download.
