NOT VOLVEX
📎 1 file 1,513 chars
📄
pasted-code-1789019840782.txt
txt 30 lines
▶
यहाँ आपके Minecraft plugin को अपडेट करने के लिए एक स्पष्ट और सटीक Prompt दिया गया है। इसे आप AI (जैसे ChatGPT, Claude, Cursor AI) को देकर अपना कोड जनरेट/अपडेट करवा सकते हैं।

🤖 Prompt (AI को देने के लिए):
Prompt:

"I want to add a fully customisable gui.yaml file to my Minecraft plugin so that every single aspect of the plugin's GUIs can be configured without modifying the source code.

Please generate/update the plugin code with the following features:

1. Create gui.yaml Config File:

Allow complete customization of every GUI menu in the plugin (Titles, Size/Rows, Item Types/Material, Display Names, Lore lines, Custom Model Data, Slot Positions, Enchants, and Item Flags).

Support custom items (fillers/glass panes, navigation buttons like Previous/Next/Close).

Support dynamic placeholders (e.g., %player%, %status%, etc.) in titles, item display names, and lores.

2. Code Implementation:

Create a dedicated GUIManager / GUIConfig handler class to load, read, and reload gui.yaml asynchronously or on startup/reload.

Implement a method to handle custom click actions dynamically based on configuration keys defined in gui.yaml (e.g., action: OPEN_MENU, action: RUN_COMMAND, action: CLOSE).

Ensure default fallback values are provided if any key is missing in gui.yaml.

3. Deliverables Needed:

A complete template for the gui.yaml file showing full customization options for all A-to-Z GUI elements.

The Java code for loading gui.yaml and building GUIs dynamically based on the configuration."
Kodari AI
KodariSep 10 at 5:59 am 2
  1. Inspect the existing plugin structure and GUI/config flow.

  2. Add a configurable gui.yaml loader and dynamic GUI builder using the project’s current APIs.

  3. Register the GUI system, wire configured actions/placeholders, and add a complete default gui.yaml template.

[Generation stopped]

NOT VOLVEX
📎 1 file 1,298 chars
📄
pasted-code-1789019883716.txt
txt 25 lines
▶
"I want to add a fully customisable gui.yaml file to my Minecraft plugin so that every single aspect of the plugin's GUIs can be configured without modifying the source code.

Please generate/update the plugin code with the following features:

1. Create gui.yaml Config File:

Allow complete customization of every GUI menu in the plugin (Titles, Size/Rows, Item Types/Material, Display Names, Lore lines, Custom Model Data, Slot Positions, Enchants, and Item Flags).

Support custom items (fillers/glass panes, navigation buttons like Previous/Next/Close).

Support dynamic placeholders (e.g., %player%, %status%, etc.) in titles, item display names, and lores.

2. Code Implementation:

Create a dedicated GUIManager / GUIConfig handler class to load, read, and reload gui.yaml asynchronously or on startup/reload.

Implement a method to handle custom click actions dynamically based on configuration keys defined in gui.yaml (e.g., action: OPEN_MENU, action: RUN_COMMAND, action: CLOSE).

Ensure default fallback values are provided if any key is missing in gui.yaml.

3. Deliverables Needed:

A complete template for the gui.yaml file showing full customization options for all A-to-Z GUI elements.

The Java code for loading gui.yaml and building GUIs dynamically based on the configuration."
Kodari AI
KodariSep 10 at 6:05 am 5
  1. Inspect the existing plugin structure, GUI entry points, and configuration/reload flow.

  2. Implement the configurable gui.yaml system around the project’s existing menus.

  3. Add dynamic item rendering, placeholders, configured actions, and default fallback behavior.

  4. Add the complete gui.yaml template and register/reload the new system.

Implemented the configurable GUI system.

  • Added GuiConfigManager for loading, reloading, fallback values, placeholders, item materials, lore, custom model data, enchantments, flags, and actions.

  • Added complete src/main/resources/gui.yaml covering:

    • Material selection GUI

    • Pattern selection GUI

    • Confirmation GUI

    • Progress GUI

    • Fillers, buttons, slots, titles, item settings, and navigation

  • Updated all GUI classes to read their settings from gui.yaml.

  • Added placeholders such as %player%, %kills%, %required%, %remaining%, %status%, %material%, and %pattern%.

  • Added configurable actions:

    • OPEN_MENU

    • RUN_COMMAND

    • CLOSE

    • SELECT_MATERIAL

    • SELECT_PATTERN

    • CONFIRM

  • Updated click handling to use configured slots instead of hard-coded positions.

  • Added /ipt reload support for reloading gui.yaml.

  • Existing config.yml GUI titles remain available as fallback values.

Edit plugins/IndiaPvPTrims/gui.yaml, then run:

Plain Text
/ipt reload
Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
16 1,641
src/main/java/com/indiapvp/trims/IndiaPvPTrims.java
/*
 * Decompiled with CFR.
 */
package com.indiapvp.trims;

import com.indiapvp.trims.gui.ProgressGUI;
import com.indiapvp.trims.gui.TrimMaterialGUI;
import com.indiapvp.trims.listeners.GUIClickListener;
import com.indiapvp.trims.listeners.KillListener;
import com.indiapvp.trims.managers.KillTracker;
import com.indiapvp.trims.managers.TrimSessionManager;
import com.indiapvp.trims.managers.GuiConfigManager;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ArmorMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.trim.ArmorTrim;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;

public final class IndiaPvPTrims
extends JavaPlugin {
    private static IndiaPvPTrims instance;
    private TrimSessionManager sessionManager;
    private KillTracker killTracker;
    private GuiConfigManager guiConfigManager;

    public void onEnable() {
        instance = this;
        this.saveDefaultConfig();
        this.guiConfigManager = new GuiConfigManager(this);
        this.sessionManager = new TrimSessionManager();
        this.killTracker = new KillTracker(this);
        this.getServer().getPluginManager().registerEvents((Listener)new GUIClickListener(this), (Plugin)this);
        this.getServer().getPluginManager().registerEvents((Listener)new KillListener(this), (Plugin)this);
        this.getServer().getScheduler().runTaskTimer((Plugin)this, () -> {
            for (Player player : Bukkit.getOnlinePlayers()) {
                TrimSessionManager.TrimPreference pref = this.sessionManager.getSavedTrim(player.getUniqueId());
                if (pref == null) continue;
                ArmorTrim trim = new ArmorTrim(pref.material, pref.pattern);
                IndiaPvPTrims.enforceOn(player.getInventory().getHelmet(), trim, i -> player.getInventory().setHelmet(i));
                IndiaPvPTrims.enforceOn(player.getInventory().getChestplate(), trim, i -> player.getInventory().setChestplate(i));
                IndiaPvPTrims.enforceOn(player.getInventory().getLeggings(), trim, i -> player.getInventory().setLeggings(i));
                IndiaPvPTrims.enforceOn(player.getInventory().getBoots(), trim, i -> player.getInventory().setBoots(i));
            }
        }, 2L, 2L);
        this.getCommand("trims").setExecutor((sender, cmd, label, args) -> {
            if (!(sender instanceof Player)) {
                sender.sendMessage(IndiaPvPTrims.colorComponent("&cOnly players can use this command."));
                return true;
            }
            Player player = (Player)sender;
            if (!player.hasPermission("indiapvptrims.use")) {
                player.sendMessage(IndiaPvPTrims.colorComponent(this.getConfig().getString("messages.prefix", "&8[&6IndiaPvP Trims&8] ") + this.getConfig().getString("messages.no-permission", "&cNo permission.")));
                return true;
            }
            if (args.length > 0 && args[0].equalsIgnoreCase("progress")) {
                ProgressGUI.open(player);
                return true;
            }
            this.sessionManager.startSession(player.getUniqueId());
            TrimMaterialGUI.open(player);
            return true;
        });
        this.getCommand("trims").setTabCompleter((sender, cmd, label, args) -> {
            String t;
            if (args.length == 1 && "progress".startsWith(t = args[0].toLowerCase())) {
                return List.of("progress");
            }
            return Collections.emptyList();
        });
        this.getCommand("indiapvptrims").setExecutor((sender, cmd, label, args) -> {
            if (!sender.hasPermission("indiapvptrims.admin")) {
                sender.sendMessage(IndiaPvPTrims.colorComponent(this.getConfig().getString("messages.prefix", "&8[&6IndiaPvP Trims&8] ") + this.getConfig().getString("messages.no-permission", "&cNo permission.")));
                return true;
            }
            if (args.length == 0 || args[0].equalsIgnoreCase("help")) {
                sender.sendMessage(IndiaPvPTrims.colorComponent("&8&m------------------------------------"));
                sender.sendMessage(IndiaPvPTrims.colorComponent("  &6IndiaPvP Trims &7v" + this.getDescription().getVersion()));
                sender.sendMessage(IndiaPvPTrims.colorComponent("&8&m------------------------------------"));
                sender.sendMessage(IndiaPvPTrims.colorComponent("  &e/trims                       &7- Open trim editor"));
                sender.sendMessage(IndiaPvPTrims.colorComponent("  &e/trims progress              &7- View unlock progress"));
                sender.sendMessage(IndiaPvPTrims.colorComponent("  &e/ipt reload                  &7- Reload config"));
                sender.sendMessage(IndiaPvPTrims.colorComponent("  &e/ipt setpoints <p> <amount>  &7- Set player kills"));
                sender.sendMessage(IndiaPvPTrims.colorComponent("  &e/ipt addpoints <p> <amount>  &7- Add player kills"));
                sender.sendMessage(IndiaPvPTrims.colorComponent("&8&m------------------------------------"));
                return true;
            }
            switch (args[0].toLowerCase()) {
                case "reload": {
                    this.reloadConfig();
                    this.guiConfigManager.reload();
                    sender.sendMessage(IndiaPvPTrims.colorComponent(this.getConfig().getString("messages.prefix", "&8[&6IndiaPvP Trims&8] ") + this.getConfig().getString("messages.plugin-reloaded", "&aReloaded.")));
                    break;
                }
                case "setpoints": {
                    if (args.length < 3) {
                        sender.sendMessage(IndiaPvPTrims.colorComponent("&cUsage: /ipt setpoints <player> <amount>"));
                        return true;
                    }
                    Player target = Bukkit.getPlayerExact((String)args[1]);
                    if (target == null) {
                        sender.sendMessage(IndiaPvPTrims.colorComponent("&cPlayer not found: " + args[1]));
                        return true;
                    }
                    try {
                        int amount = Integer.parseInt(args[2]);
                        this.killTracker.setPoints(target.getUniqueId(), amount);
                        sender.sendMessage(IndiaPvPTrims.colorComponent("&aSet &f" + target.getName() + "&a's kills to &f" + amount + "&a."));
                    }
                    catch (NumberFormatException e) {
                        sender.sendMessage(IndiaPvPTrims.colorComponent("&cInvalid number: " + args[2]));
                    }
                    break;
                }
                case "addpoints": {
                    if (args.length < 3) {
                        sender.sendMessage(IndiaPvPTrims.colorComponent("&cUsage: /ipt addpoints <player> <amount>"));
                        return true;
                    }
                    Player target = Bukkit.getPlayerExact((String)args[1]);
                    if (target == null) {
                        sender.sendMessage(IndiaPvPTrims.colorComponent("&cPlayer not found: " + args[1]));
                        return true;
                    }
                    try {
                        int amount = Integer.parseInt(args[2]);
                        this.killTracker.addPoints(target.getUniqueId(), amount);
                        int total = this.killTracker.getPoints(target.getUniqueId());
                        sender.sendMessage(IndiaPvPTrims.colorComponent("&aAdded &f" + amount + " &akills to &f" + target.getName() + "&a. Total: &f" + total + "&a."));
                    }
                    catch (NumberFormatException e) {
                        sender.sendMessage(IndiaPvPTrims.colorComponent("&cInvalid number: " + args[2]));
                    }
                    break;
                }
                default: {
                    sender.sendMessage(IndiaPvPTrims.colorComponent("&cUnknown sub-command. Use &f/ipt help&c."));
                }
            }
            return true;
        });
        this.getCommand("indiapvptrims").setTabCompleter((sender, cmd, label, args) -> {
            if (args.length == 1) {
                String t = args[0].toLowerCase();
                return List.of("help", "reload", "setpoints", "addpoints").stream().filter(s -> s.startsWith(t)).toList();
            }
            return Collections.emptyList();
        });
        this.getLogger().info("IndiaPvP Trims v" + this.getDescription().getVersion() + " enabled.");
    }

    public void onDisable() {
        if (this.sessionManager != null) {
            this.sessionManager.clearAll();
        }
        if (this.killTracker != null) {
            this.killTracker.saveSync();
        }
        this.getLogger().info("IndiaPvP Trims disabled.");
    }

    private static void enforceOn(ItemStack item, ArmorTrim trim, Consumer<ItemStack> setter) {
        if (item == null || item.getType() == Material.AIR) {
            return;
        }
        ItemMeta itemMeta = item.getItemMeta();
        if (!(itemMeta instanceof ArmorMeta)) {
            return;
        }
        ArmorMeta meta = (ArmorMeta)itemMeta;
        ArmorTrim existing = meta.getTrim();
        if (existing != null && existing.getMaterial().equals((Object)trim.getMaterial()) && existing.getPattern().equals((Object)trim.getPattern())) {
            return;
        }
        meta.setTrim(trim);
        item.setItemMeta((ItemMeta)meta);
        setter.accept(item);
    }

    public static IndiaPvPTrims getInstance() {
        return instance;
    }

    public TrimSessionManager getSessionManager() {
        return this.sessionManager;
    }

    public KillTracker getKillTracker() {
        return this.killTracker;
    }