Z

PROMPT PARA GENERACIÓN DE PLUGIN: ADVANCED CUSTOM CRATES (CCI)

CONTEXTO DE DESARROLLO Actúa como un desarrollador experto en Java para Minecraft (Spigot/Paper API). El objetivo es crear un plugin de cajas de recompensa altamente profesional llamado "CCI" que utilice exclusivamente interfaces gráficas (INVENTORY GUI) y soporte texturas personalizadas.

---

SISTEMA DE COMANDOS (CCI ROOT) Generar un comando base /cci con los siguientes subcomandos: * /cci create <nombre> - Registro inicial de la caja. * /cci delete <nombre> - Eliminación total de datos y hologramas. * /cci edit <nombre> - Abre el Panel Maestro de configuración (INVENTORY GUI 54 slots). * /cci rename <nombre> <nuevo_nombre> - Actualización de ID y títulos. * /cci rewards <nombre> - Editor visual de tabla de botín. * /cci addreward <nombre> - Agrega el item en mano a la base de datos de la caja. * /cci set <nombre> - Vincula la caja al bloque (Chest/EnderChest) que el jugador mira.

---

ESPECIFICACIONES DE INTERFAZ (INVENTORY GUI & TEXTURE)

  1. DISEÑO PROFESIONAL: Los menús deben usar bordes de cristal tintado, iconos con CustomModelData y soporte para texturas de Resource Packs.
  2. PANEL MAESTRO: Debe incluir botones interactivos para:

* Activar/Desactivar hologramas dinámicos. * Seleccionar animaciones (Estilo CS:GO, Ruleta o Instantáneo). * Configurar partículas y efectos de sonido al abrir.

  1. EDITOR DE RECOMPENSAS: Sistema de "Drag & Drop". Al hacer click en un ítem dentro del INVENTORY GUI, permitir:

* Configurar la probabilidad de aparición (%). * Añadir comandos de consola que se ejecutan al ganar el ítem.

---

REQUISITOS TÉCNICOS Y VISUALES * HOLOGRAMAS: Integración nativa para mostrar el nombre de la caja y un ítem flotante que rote 360 grados sobre el bloque. * REWARDS SYSTEM: Algoritmo de pesos para probabilidades exactas y soporte para ítems con NBT personalizado. * PERSISTENCIA: Almacenamiento optimizado en archivos YAML (config.yml, crates.yml, rewards.yml). * MENSAJES: Todo el sistema de mensajes debe soportar colores HEX (&#RRGGBB) y ser totalmente configurable.

---

ESTRUCTURA DE CÓDIGO REQUERIDA

  1. Clase Principal (JavaPlugin).
  2. Gestor de Inventarios (InventoryHolder & Events).
  3. CrateManager (Lógica de creación y selección de bloques).
  4. RewardEngine (Cálculo de botín y ejecución de comandos).
  5. HologramProvider (Interface para manejo de displays flotantes).

---

ENTREGA DE CÓDIGO Proporciona el código limpio, comentado, con manejo de errores (try-catch) y optimizado para versiones 1.16 a 1.20+.

Kodari AI
KodariJun 2 at 6:49 am 97
CCI
Advanced Custom Crates plugin for Minecraft 1.16–1.20+. Create and manage reward crates linked to physical blocks with a full inventory GUI system. Features a 54-slot Master Panel for configuration, visual rewards editor with drag-and-drop support, three animation styles (CS:GO reel, Roulette, Instant), ArmorStand-based floating holograms with rotating items, weighted reward probability engine, console command execution on win, and full HEX color support across all messages and displays.

Here’s a summary of everything that was built:


Plugin Architecture — 25 files

Layer
Files
Core
CCIPlugin
,
plugin.yml
,
config.yml
,
crates.yml
,
pom.xml
Models
Crate
,
CrateReward
,
AnimationType
Managers
CrateManager
,
RewardEngine
,
HologramManager
,
PendingInputManager
Commands
CCICommand
(executor + tab completer)
Listeners
CrateListener
(interact + chat input)
Animation
CrateAnimation
(scrolling reel with
ActiveSession
+
ScrollRunnable
inner classes)
GUI Framework
InventoryHandler
,
InventoryButton
,
InventoryGUI
,
GUIManager
,
GUIListener
GUI Screens
MasterPanelGUI
(54-slot panel),
RewardsEditorGUI
(paginated),
RewardConfigGUI
(weight +/- buttons + commands)
Utilities
ColorUtil
(HEX
&#RRGGBB
+ legacy
&
),
ItemBuilder
(fluent builder)

Key behaviours:

  • Holograms — 3 ArmorStands per crate: display name, subtitle, rotating item helmet (8°/2 ticks)

  • Animations — CS:GO uses a 27-slot scrolling reel (30 scrolls, gradual slowdown); Roulette uses same system but 40 scrolls with faster start; Instant skips to reward immediately with particles + sound

  • Rewards — Weighted random selection; win plays sound + title + sends item to inventory (overflow drops)

  • Chat input — PendingInputManager handles async chat collection for adding console commands to rewards

  • Persistence — All crate + reward data in crates.yml using Bukkit’s native ItemStack YAML serialization

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
25 2,251
src/main/java/com/cci/CCIPlugin.java
package com.cci;

import com.cci.animation.CrateAnimation;
import com.cci.command.CCICommand;
import com.cci.inventory.gui.GUIListener;
import com.cci.inventory.gui.GUIManager;
import com.cci.listener.CrateListener;
import com.cci.manager.CrateManager;
import com.cci.manager.HologramManager;
import com.cci.manager.PendingInputManager;
import com.cci.manager.RewardEngine;
import com.cci.util.ColorUtil;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class CCIPlugin extends JavaPlugin {

    private GUIManager guiManager;
    private CrateManager crateManager;
    private RewardEngine rewardEngine;
    private HologramManager hologramManager;
    private CrateAnimation crateAnimation;
    private PendingInputManager pendingInputManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        guiManager = new GUIManager();
        crateManager = new CrateManager(this);
        rewardEngine = new RewardEngine(this);
        hologramManager = new HologramManager(this);
        pendingInputManager = new PendingInputManager();
        crateAnimation = new CrateAnimation(this, guiManager);

        crateManager.loadCrates();
        hologramManager.spawnAll();

        CCICommand cciCommand = new CCICommand(this);
        getCommand("cci").setExecutor(cciCommand);
        getCommand("cci").setTabCompleter(cciCommand);

        getServer().getPluginManager().registerEvents(new GUIListener(guiManager), this);
        getServer().getPluginManager().registerEvents(new CrateListener(this), this);

        getLogger().info("CCI enabled — " + crateManager.getCrates().size() + " crate(s) loaded.");
    }

    @Override
    public void onDisable() {
        crateAnimation.cancelAll();
        hologramManager.removeAll();
        crateManager.saveCrates();
        pendingInputManager.clear();
        getLogger().info("CCI disabled.");
    }

    public String msg(String key) {
        String prefix = ColorUtil.colorize(getConfig().getString("prefix", "&#FFD700[CCI]&r "));
        String message = ColorUtil.colorize(getConfig().getString("messages." + key,
                "&cMissing message key: " + key));
        return prefix + message;
    }

    public String msg(String key, String... replacements) {
        String message = msg(key);
        for (int i = 0; i + 1 < replacements.length; i += 2) {
            message = message.replace(replacements[i], replacements[i + 1]);
        }
        return message;
    }
}