liviu007
๐Ÿ“Ž 1 file 4,509 chars
๐Ÿ“„
pasted-code-1779480012277.txt
txt 63 lines
โ–ถ
Role: You are an expert Senior Java Developer specializing in high-performance, enterprise-grade Minecraft plugins for the PaperMC API.

Objective: Create a complete, production-ready Minecraft plugin named RNGSMP1 for Paper 1.21.1. The plugin must be built using Maven, follow strict OOP principles, be highly optimized for high player counts, and be completely bug/exploit-free.

1. Technical Specifications & Architecture
Language: Java 21 (or highest supported by Paper 1.21.1).
API: Paper-API 1.21.1.
Build System: Maven (provide complete pom.xml with dependencies for Paper, Adventure, and LuckPerms).
Project Structure: Follow standard Maven layout (src/main/java/com/rngsmp1/..., src/main/resources).
Code Quality: Clean, modular, documented (Javadoc), utilizing Managers/Services pattern.
Performance:
Use Asynchronous tasks (Folia-compatible where possible, otherwise standard Bukkit Scheduler) for all I/O, configuration saving, and heavy calculations.
Implement a Smart Cache system (e.g., Caffeine or Caffeine-backed HashMap) for player data to minimize config reads.
Optimize event listeners (ignore cancelled events where appropriate, use lowest priority for monitoring).
Strictly No Memory Leaks: Ensure proper cleanup on plugin disable or player quit. Use PersistentDataContainer instead of metadata.
Formatting: Use Adventure API / MiniMessage for all chat, action bar, and INVENTORY GUI text to support Hex colors and modern formatting.
2. Core Features to Implement
A. The Luck/RNG System (Crucial Feature)

Implement a system that assigns a "Luck Multiplier" to players based on permissions (e.g., rngsmp.luck.1.5, rngsmp.luck.2.0).
Create an internal API that other modules can call to get a player's current multiplier.
Integrate with PlaceholderAPI to provide placeholders like %rngsmp_luck% and %rngsmp_luck_formatted%.
B. Item Limiter

Configurable limits on specific items in a player's inventory (e.g., max 2 God Apples).
Checks on pickup, inventory click, and item drop.
Displays an Action Bar warning using MiniMessage when a limit is hit.
C. Combat System

Combat tagging system (configurable timer).
Prevents command usage and logging out while tagged.
Anti-Logout Penalty: Kills the player if they NPC-log or force-quit while tagged.
Visual combat timer (Action Bar).
D. Utility Systems

Kits: INVENTORY GUI-based kit claiming with cooldowns stored in PersistentData.
Invsee/Endersee: View and edit offline/online player inventories.
Vanish: Complete vanish system (hides from tab, entity tracking, messages).
Custom Recipes & One-Craft Items: System to register custom recipes, some limited to being crafted only once per player (tracked via PDC).
3. Hyper-Advanced Admin INVENTORY GUI System
Create a master "Admin Control Panel" (/rngadmin) to configure every module in-game.

Design: Modern, clean, professional. Use colored glass pane borders for spacing.
Main Menu: Categories for every system (Combat, Items, Luck, Kits, etc.) using custom Player Heads or relevant materials.
Functionality:
Robust Pagination system for categories with many items (e.g., Kits or Limited Items). Include functional "Next Page" and "Back Page" buttons.
Interactive elements: Left-click to increase a value, right-click to decrease, shift-click to toggle.
Configurability: Every item, slot, title, and lore in the GUIs must be defined in a guis.yml.
Feel: Add click sounds (Sound.UI_BUTTON_CLICK) and feedback messages on settings changes.
Security: Ensure absolute protection against item dupe exploits (cancelling clicks correctly, handling inventory drag).
4. Configuration & Infrastructure
config.yml: Heavily commented. Includes toggles for every module, combat timers, item lists, and debug mode.
messages.yml: All player-facing messages using MiniMessage format.
Commands: Implement a base command (/rngsmp) with subcommands (reload, help) and a robust permission structure (e.g., rngsmp.admin, rngsmp.command.vanish).
Reload: Implement a smart reload that re-caches configurations and updates GUIs without server restart.
5. Output Requirements
Provide the complete, compilable source code and resources:

pom.xml
plugin.yml (including permissions and commands definitions).
Fully commented config.yml, messages.yml, and guis.yml.
All Java classes organized in packages (e.g., .api, .commands, .listeners, .modules.combat, .modules.luck, .ui, .util).
Do not provide snippets. Provide the full, production-ready project.
Kodari AI
KodariMay 22 at 8:12 pm 53,501 (v2)

Iโ€™ll build this comprehensive plugin. Let me plan the architecture first:

  • Package structure: com.rngsmp1 with subpackages for commands, listeners, managers, modules, inventory, util

  • Core managers: LuckManager, CombatManager, KitManager, VanishManager, ItemLimiterManager

  • GUI system: Reusable InventoryGUI framework with GUIManager/GUIListener

  • Config system: ConfigManager, MessageManager loading from YML files

  • PlaceholderAPI expansion for luck placeholders

RNGSMP1
A feature-rich SMP plugin with an RNG/Luck multiplier system, item limiter, combat tagging with anti-logout, kit GUI, invsee/endersee, vanish, and custom recipes. Includes a hyper-advanced admin control panel GUI (/rngadmin) for in-game configuration. All text uses MiniMessage/Adventure API. Data stored via PersistentDataContainer with async I/O and smart caching.

Good. Now Iโ€™ll generate all remaining files. Let me plan the full file list and create them all:

RNGSMP1
A feature-rich SMP plugin with an RNG/Luck multiplier system, item limiter, combat tagging with anti-logout, kit GUI, invsee/endersee, vanish, and custom recipes. Includes a hyper-advanced admin control panel GUI (/rngadmin) for in-game configuration. All text uses MiniMessage/Adventure API. Data stored via PersistentDataContainer with async I/O and smart caching.

Now I need to add isManaged to GUIManager:Let me read the files Iโ€™ve created so far and then generate all remaining files properly:

Good. Now I have a complete picture of all existing files. Let me generate all remaining files:

Now the GUI implementations:

All files are now generated. Hereโ€™s a summary of everything created:


Project structure โ€” 35 files total:

Layer
Files
Root
pom.xml
Resources
plugin.yml
,
config.yml
,
messages.yml
,
guis.yml
Main class
RNGSMP1.java
API
LuckAPI.java
(interface)
Managers
ConfigManager
,
MessageManager
Inventory framework
InventoryHandler
,
InventoryButton
,
InventoryGUI
,
GUIManager
,
GUIListener
GUI implementations
AdminMainGUI
,
AdminCombatGUI
,
AdminLuckGUI
,
AdminItemLimiterGUI
,
AdminKitsGUI
,
AdminVanishGUI
,
KitSelectionGUI
Modules
LuckManager
,
CombatManager
,
ItemLimiterManager
+
ItemLimit
,
KitManager
+
Kit
,
VanishManager
,
RecipeManager
Listeners
CombatListener
,
ItemLimiterListener
,
VanishListener
,
RecipeListener
,
PlayerSessionListener
Commands
RNGSMPCommand
,
RNGAdminCommand
,
KitCommand
,
InvseeCommand
,
EnderseeCommand
,
VanishCommand
,
CombatCommand
Placeholder
RNGPlaceholderExpansion
Utilities
ItemBuilder
,
TimeUtil
,
GuiUtil

Key design decisions:

  • Combat tag uses a live HashMap<UUID, Long> expiry โ€” no scheduler per-player, just one shared ticker

  • Vanish state persists across restarts via PersistentDataContainer

  • One-craft recipes tracked per-player via PDC with a namespaced key per recipe ID

  • All admin GUIs refresh themselves after every setting change by closing and reopening

  • Item limiter enforces on pickup, click, drag, and join โ€” covers all dupe vectors

liviu007

The compilation failed with this error:

code
Compilation failed with 1 error(s):

ERROR in src/main/java/com/rngsmp1/RNGSMP1.java at line 16: cannot find symbol
import com.rngsmp1.util.MessageUtil;
                       ^
  symbol: class MessageUtil
  location: package com.rngsmp1.util


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - MessageUtil
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/com/rngsmp1/RNGSMP1.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariMay 22 at 8:13 pm 1,019 (v2)

Let me read the relevant files to understand whatโ€™s needed.

RNGSMP1.java imports com.rngsmp1.util.MessageUtil but that class doesnโ€™t exist โ€” the project uses MessageManager instead. The fix is simply to remove the unused import.

Removed the stale import com.rngsmp1.util.MessageUtil โ€” the project already uses MessageManager for all messaging, so no MessageUtil class is needed.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
45 3,727
src/main/java/com/rngsmp1/RNGSMP1.java
package com.rngsmp1;

import com.rngsmp1.api.LuckAPI;
import com.rngsmp1.commands.*;
import com.rngsmp1.inventory.gui.GUIListener;
import com.rngsmp1.inventory.gui.GUIManager;
import com.rngsmp1.listeners.*;
import com.rngsmp1.managers.*;
import com.rngsmp1.modules.combat.CombatManager;
import com.rngsmp1.modules.itemlimiter.ItemLimiterManager;
import com.rngsmp1.modules.kit.KitManager;
import com.rngsmp1.modules.luck.LuckManager;
import com.rngsmp1.modules.recipes.RecipeManager;
import com.rngsmp1.modules.vanish.VanishManager;
import com.rngsmp1.placeholder.RNGPlaceholderExpansion;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class RNGSMP1 extends JavaPlugin {

    private static RNGSMP1 instance;

    private ConfigManager configManager;
    private MessageManager messageManager;
    private GUIManager guiManager;
    private LuckManager luckManager;
    private CombatManager combatManager;
    private ItemLimiterManager itemLimiterManager;
    private KitManager kitManager;
    private VanishManager vanishManager;
    private RecipeManager recipeManager;

    @Override
    public void onEnable() {
        instance = this;

        saveDefaultConfig();
        saveResource("messages.yml", false);
        saveResource("guis.yml", false);

        this.configManager = new ConfigManager(this);
        this.messageManager = new MessageManager(this);
        this.guiManager = new GUIManager();

        this.luckManager = new LuckManager(this);
        this.combatManager = new CombatManager(this);
        this.itemLimiterManager = new ItemLimiterManager(this);
        this.kitManager = new KitManager(this);
        this.vanishManager = new VanishManager(this);
        this.recipeManager = new RecipeManager(this);

        registerListeners();
        registerCommands();

        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            new RNGPlaceholderExpansion(this).register();
            getLogger().info("PlaceholderAPI hooked successfully.");
        }

        getLogger().info("RNGSMP1 enabled successfully.");
    }

    @Override
    public void onDisable() {
        if (combatManager != null) {
            combatManager.shutdown();
        }
        if (vanishManager != null) {
            vanishManager.shutdown();
        }
        getLogger().info("RNGSMP1 disabled.");
    }

    private void registerListeners() {
        GUIListener guiListener = new GUIListener(guiManager);
        Bukkit.getPluginManager().registerEvents(guiListener, this);
        Bukkit.getPluginManager().registerEvents(new CombatListener(this), this);
        Bukkit.getPluginManager().registerEvents(new ItemLimiterListener(this), this);
        Bukkit.getPluginManager().registerEvents(new VanishListener(this), this);
        Bukkit.getPluginManager().registerEvents(new RecipeListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PlayerSessionListener(this), this);
    }

    private void registerCommands() {
        getCommand("rngsmp").setExecutor(new RNGSMPCommand(this));
        getCommand("rngadmin").setExecutor(new RNGAdminCommand(this));
        getCommand("kit").setExecutor(new KitCommand(this));
        getCommand("invsee").setExecutor(new InvseeCommand(this));
        getCommand("endersee").setExecutor(new EnderseeCommand(this));
        getCommand("vanish").setExecutor(new VanishCommand(this));
        getCommand("combat").setExecutor(new CombatCommand(this));
    }

    public void reload() {
        reloadConfig();
        configManager.reload();
        messageManager.reload();
        luckManager.reload();
        combatManager.reload();
        itemLimiterManager.reload();
        kitManager.reload();
        vanishManager.reload();
        recipeManager.reload();
    }

    public static RNGSMP1 getInstance() {
        return instance;
    }

    public ConfigManager cfg() {
        return configManager;
    }

    public MessageManager msg() {
        return messageManager;
    }

    public GUIManager getGUIManager() {
        return guiManager;
    }

    public LuckManager getLuckManager() {
        return luckManager;
    }

    public CombatManager getCombatManager() {
        return combatManager;
    }

    public ItemLimiterManager getItemLimiterManager() {
        return itemLimiterManager;
    }

    public KitManager getKitManager() {
        return kitManager;
    }

    public VanishManager getVanishManager() {
        return vanishManager;
    }

    public RecipeManager getRecipeManager() {
        return recipeManager;
    }

    public LuckAPI getLuckAPI() {
        return luckManager;
    }
}