saturoluffy

Create a CustomCrates plugin for Paper 1.21.11 with unlimited configurable crates, physical and virtual keys, animated crate openings, preview and editor GUIs, reward chances, and support for Vault, PlaceholderAPI, LuckPerms, and CoinsEngine. Include Vote, Common, Rare, Epic, Legendary, Lifesteal, and Seasonal crates. Rewards should include money, coins, commands, items, permissions, Blood Coins, Heart Fragments, Heart Crystals, Revive Crystals, Permanent Hearts, vouchers, titles, sounds, particles, and fireworks. Add fully functional custom items: Auto Smelter Pickaxe, Tree Feller Axe, Fortune Hammer (3×3 mining), Builder Wand, Treasure Compass, and Blood Sword. Everything should be configurable, optimized, and compatible with a CustomLifesteal plugin so crates can reward hearts and revive items. The plugin should be polished, bug-free, and ready for use on a public server.

Kodari AI
KodariJul 1 at 12:42 pm 152

I’ll build a full-featured CustomCrates plugin for Paper 1.21.

CustomCrates
A feature-rich crate plugin with unlimited configurable crates (Vote, Common, Rare, Epic, Legendary, Lifesteal, Seasonal), physical and virtual keys, animated roulette-style openings, preview and admin editor GUIs, and weighted reward chances. Supports Vault, PlaceholderAPI, LuckPerms, CoinsEngine, and CustomLifesteal (Blood Coins, Heart Fragments/Crystals, Revive Crystals, Permanent Hearts). Includes fully functional custom tools: Auto Smelter Pickaxe, Tree Feller Axe, Fortune Hammer, Builder Wand, Treasure Compass, and Blood Sword. Fully configurable via YAML, optimized, and ready for production servers.

Plugin complete. Highlights:

  • Crates: 7 default crates (Vote, Common, Rare, Epic, Legendary, Lifesteal, Seasonal) auto-generated on first run, fully configurable in crates.yml (weighted rewards, sounds, particles, fireworks, broadcasts).

  • Keys: virtual keys (/crate give, persisted in keys.yml) and physical keys (PDC-tagged items via /crate givekey); crate blocks linked with /crate setblock.

  • Rewards: money (Vault), coins (CoinsEngine), commands, items, permissions (LuckPerms, with duration), Blood Coins/Heart Fragments/Heart Crystals/Revive Crystals/Permanent Hearts (CustomLifesteal-compatible via configurable command bridge with graceful fallback), vouchers, titles, sounds, particles, fireworks.

  • GUIs: animated roulette-style opening GUI, crate preview GUI, and an admin crate list/editor GUI, all built on the reusable inventory-button framework.

  • Custom items: Auto Smelter Pickaxe, Tree Feller Axe, Fortune Hammer (3x3 mining), Builder Wand, Treasure Compass, Blood Sword — all PDC-tagged, fully functional, and configurable via config.yml.

  • Commands: /crate with subcommands for list/preview/open/keys/give/givekey/create/delete/setblock/removeblock/reward add|remove/editor/item give/reload, with tab completion and permission gating (customcrates.use, customcrates.admin).

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
38 2,537
src/main/java/com/kodari/customcrates/CustomCrates.java
package com.kodari.customcrates;

import com.kodari.customcrates.command.CrateCommand;
import com.kodari.customcrates.config.ConfigManager;
import com.kodari.customcrates.crate.AnimationManager;
import com.kodari.customcrates.crate.CrateBlockManager;
import com.kodari.customcrates.crate.CrateManager;
import com.kodari.customcrates.crate.KeyManager;
import com.kodari.customcrates.crate.RewardManager;
import com.kodari.customcrates.hook.CoinsEngineHook;
import com.kodari.customcrates.hook.LifestealHook;
import com.kodari.customcrates.hook.LuckPermsHook;
import com.kodari.customcrates.hook.PlaceholderHook;
import com.kodari.customcrates.hook.VaultHook;
import com.kodari.customcrates.inventory.gui.GUIListener;
import com.kodari.customcrates.inventory.gui.GUIManager;
import com.kodari.customcrates.item.CrateKeyItem;
import com.kodari.customcrates.item.CustomItemManager;
import com.kodari.customcrates.listener.CrateBlockListener;
import com.kodari.customcrates.listener.CustomItemListener;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class CustomCrates extends JavaPlugin {
    private ConfigManager configManager;
    private CrateManager crateManager;
    private KeyManager keyManager;
    private CrateBlockManager crateBlockManager;
    private CustomItemManager customItemManager;
    private CrateKeyItem crateKeyItem;
    private GUIManager guiManager;
    private RewardManager rewardManager;
    private AnimationManager animationManager;
    private VaultHook vaultHook;
    private CoinsEngineHook coinsEngineHook;
    private LuckPermsHook luckPermsHook;
    private LifestealHook lifestealHook;
    private PlaceholderHook placeholderHook;

    @Override
    public void onEnable() {
        this.configManager = new ConfigManager(this);
        this.configManager.loadAll();

        this.crateManager = new CrateManager(this);
        this.crateManager.loadCrates();

        this.keyManager = new KeyManager(this);
        this.keyManager.load();

        this.crateBlockManager = new CrateBlockManager(this);
        this.crateBlockManager.load();

        this.customItemManager = new CustomItemManager(this);
        this.crateKeyItem = new CrateKeyItem(this);
        this.rewardManager = new RewardManager(this);
        this.animationManager = new AnimationManager(this);

        this.vaultHook = new VaultHook();
        this.coinsEngineHook = new CoinsEngineHook();
        this.luckPermsHook = new LuckPermsHook();
        this.lifestealHook = new LifestealHook(this);

        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            this.placeholderHook = new PlaceholderHook(this);
            this.placeholderHook.register();
        }

        this.guiManager = new GUIManager();
        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
        Bukkit.getPluginManager().registerEvents(new CrateBlockListener(this), this);
        Bukkit.getPluginManager().registerEvents(new CustomItemListener(this), this);

        CrateCommand crateCommand = new CrateCommand(this);
        getCommand("crate").setExecutor(crateCommand);
        getCommand("crate").setTabCompleter(crateCommand);

        getLogger().info("CustomCrates has been enabled.");
    }

    @Override
    public void onDisable() {
        if (keyManager != null) keyManager.save();
        if (crateBlockManager != null) crateBlockManager.save();
        if (crateManager != null) crateManager.saveCrates();
        getLogger().info("CustomCrates has been disabled.");
    }
}