B

Develop the "EliteSMP Plugin" to introduce custom items with unique textures and enchantments, allowing server admins to define item properties via a configuration file. Include support for item crafting, a user-friendly command interface for item management, and compatibility with resource packs for seamless texture integration.

Kodari AI
KodariJun 7 at 9:48 am 1

I’ll create the EliteSMP Plugin — a custom items plugin with unique textures, enchantments, crafting, commands, and resource pack support.

EliteSMP
A server management plugin introducing custom items with unique textures and enchantments. Admins define item properties via config, including custom model data for resource pack textures, custom enchantments with triggered effects, and shaped crafting recipes. Features a command interface for item management and a GUI menu system for easy item distribution.

Starting with resource files, then core classes, then GUI system.

EliteSMP
A custom items plugin with unique textures and enchantments for SMP servers. Admins define items in config with custom model data for resource pack textures, custom enchantments with triggered combat effects, and crafting recipes. Includes a GUI for item distribution and Folia-compatible scheduling.

I’ll create all project files now, starting with resources then building up through config → items → enchantments → GUI framework → commands/listeners/utils

Now I’ll create every file for the project.

Now the main plugin class:

All files created. Here’s what was built:

EliteSMP Plugin — Custom items with textures, enchants, crafting, commands, and GUI.

File Structure

Plain Text
src/main/resources/
├── plugin.yml              # Plugin descriptor with folia-support
├── config.yml              # Default items (elite_sword, flame_bow, tank_helmet)
                            # and enchantments (lightning_strike, poison_touch,
                            # explosive_shot, fortify) + messages
manifest.kod                # folialib dependency
build.gradle                # spigot-api (compileOnly)

src/main/java/com/elitesmp/
├── EliteSMP.java           # Main plugin — initializes all systems
├── util/
│   └── MessageUtil.java    # Color translation (&a → §a) + strip
├── inventory/
│   ├── InventoryHandler.java   # Interface (onClick/Open/Close)
│   ├── InventoryButton.java    # Builder: creator + consumer lambdas
│   ├── InventoryGUI.java       # Abstract GUI with lazy inventory, button map
│   └── gui/
│       ├── GUIManager.java     # Tracks active inventories
│       └── GUIListener.java    # Forwards events to GUIManager
├── enchant/
│   ├── CustomEnchant.java      # POJO: id, displayName, trigger, chance, cooldown
│   └── EnchantRegistry.java    # Loads from config, stores by ID
├── item/
│   ├── CustomItem.java         # POJO: material, CMD, name, lore, enchants, attributes, recipe
│   ├── ItemBuilder.java        # Builds ItemStack from CustomItem, stores enchants in PDC
│   └── ItemRegistry.java       # Loads items from config, pre-builds ItemStacks
├── crafting/
│   └── CraftingManager.java    # Registers shaped recipes, removes old EliteSMP recipes on reload
├── listener/
│   └── EnchantListener.java    # HIT_ENTITY, PROJECTILE_HIT, DAMAGE_TAKEN triggers
├── gui/
│   └── ItemMenuGUI.java        # Clickable item list GUI (click to claim)
└── command/
    └── ItemCommand.java        # /esmp give <player> <item> [amount]
                                # /esmp list | menu | reload + tab-complete

Key Features

  • Config-driven items — Material, custom model data (for resource pack textures), enchants, attributes, lore all defined in config.yml

  • Custom enchantments — 3 trigger types: HIT_ENTITY, PROJECTILE_HIT, DAMAGE_TAKEN. Configurable chance-per-level and cooldown. Current effects: lightning strike, poison, explosion, fortify damage reduction

  • Crafting — Shaped recipes defined in config, registered with NamespacedKey, auto-cleaned on reload

  • GUI — /esmp menu opens an inventory with all items; click any to receive it

  • FoliaLib — All entity/location operations use runAtEntity/runAtLocation for Folia thread safety; auto-cancels on disable

  • PDC — Custom item IDs and enchant data stored in persistent data containers, survive item stacking/saving

  • Commands — /esmp give, list, menu, reload with tab completion and permission checks

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
Code
20 1,325
src/main/java/com/elitesmp/EliteSMP.java
package com.elitesmp;

import com.elitesmp.command.ItemCommand;
import com.elitesmp.crafting.CraftingManager;
import com.elitesmp.enchant.EnchantRegistry;
import com.elitesmp.inventory.gui.GUIListener;
import com.elitesmp.inventory.gui.GUIManager;
import com.elitesmp.item.ItemBuilder;
import com.elitesmp.item.ItemRegistry;
import com.elitesmp.listener.EnchantListener;
import com.tcoded.folialib.FoliaLib;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class EliteSMP extends JavaPlugin {

    private FoliaLib foliaLib;
    private GUIManager guiManager;
    private EnchantRegistry enchantRegistry;
    private ItemBuilder itemBuilder;
    private ItemRegistry itemRegistry;
    private CraftingManager craftingManager;

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

        foliaLib = new FoliaLib(this);
        guiManager = new GUIManager();

        // Enchantments
        enchantRegistry = new EnchantRegistry(getLogger());
        enchantRegistry.loadFromConfig(getConfig());

        // Items
        itemBuilder = new ItemBuilder(this, enchantRegistry);
        itemRegistry = new ItemRegistry(itemBuilder, getLogger());
        itemRegistry.loadFromConfig(getConfig());

        // Crafting
        craftingManager = new CraftingManager(this, itemRegistry);
        craftingManager.registerRecipes();

        // Listeners
        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
        Bukkit.getPluginManager().registerEvents(new EnchantListener(this, enchantRegistry, foliaLib), this);

        // Commands
        ItemCommand itemCommand = new ItemCommand(this, itemRegistry, guiManager);
        getCommand("elitesmp").setExecutor(itemCommand);
        getCommand("elitesmp").setTabCompleter(itemCommand);

        getLogger().info("EliteSMP enabled successfully!");
    }

    @Override
    public void onDisable() {
        if (foliaLib != null) {
            foliaLib.getScheduler().cancelAllTasks();
        }
        getLogger().info("EliteSMP disabled.");
    }

    public FoliaLib getFoliaLib() { return foliaLib; }
    public GUIManager getGuiManager() { return guiManager; }
    public EnchantRegistry getEnchantRegistry() { return enchantRegistry; }
    public ItemBuilder getItemBuilder() { return itemBuilder; }
    public ItemRegistry getItemRegistry() { return itemRegistry; }
    public CraftingManager getCraftingManager() { return craftingManager; }
}