Lex Luther

HKMCCustomEnchants – Advanced Custom Enchantment Plugin

Develop a complete, production-ready Minecraft Java plugin named HKMCCustomEnchants for my HKMC Minecraft server.

  1. Server Requirements
  • Server software: Paper
  • Minecraft version: 26.2
  • Java version: 25
  • Plugin language: Java
  • Build system: Gradle
  • Plugin must support Java and Bedrock players (Geyser/Floodgate).
  • Must work alongside other popular plugins such as EssentialsX, LuckPerms, Vault, BetterTeams, and GrimAC.
  1. Custom Enchantment System

Create a custom enchantment system that supports extremely high enchantment levels.

Examples:

  • Sharpness I–2000
  • Protection I–2000
  • Unbreaking I–2000
  • Efficiency I–2000
  • Fire Aspect I–2000
  • Knockback I–2000
  • Power I–2000
  • Fortune I–2000
  • Looting I–2000
  • Thorns I–2000
  • Feather Falling I–2000
  • Projectile Protection I–2000
  • Blast Protection I–2000
  • Fire Protection I–2000
  • Sweeping Edge I–2000

Allow administrators to configure the maximum level of each enchantment independently.

  1. Enchantment Mechanics

Custom enchantments must have actual gameplay effects.

Examples:

Sharpness

  • Increases melee attack damage.
  • Higher levels deal more damage.
  • Must support levels up to 2000.

Protection

  • Reduces incoming damage.
  • Higher levels provide stronger protection.
  • Must have configurable damage reduction limits.

Efficiency

  • Increases mining speed.
  • Must support extremely high levels without breaking blocks incorrectly.

Unbreaking

  • Reduces durability consumption.
  • Must work with all compatible equipment.

Fire Aspect

  • Increases fire damage duration.
  • Configurable maximum duration.

Fortune

  • Increases compatible block drops.
  • Must include configurable drop multipliers and anti-exploit limits.

Looting

  • Increases mob drops.
  • Configurable maximum drop multiplier.

All enchantments must have configurable mechanics and reasonable performance limits.

  1. Commands

Main command: "/ce"

  • "/ce help" – Display all commands.
  • "/ce give <player> <enchantment> <level>" – Give a custom enchanted book.
  • "/ce enchant <enchantment> <level>" – Enchant the item in your hand.
  • "/ce remove <enchantment>" – Remove an enchantment from the held item.
  • "/ce clear" – Remove all custom enchantments from the held item.
  • "/ce info" – Display enchantments on the held item.
  • "/ce list" – Display all available enchantments.
  • "/ce maxlevel <enchantment> <level>" – Change maximum enchantment level.
  • "/ce reload" – Reload configuration.
  • "/ce version" – Display plugin version.
  1. Enchantment Books
  • Custom enchanted books must have unique names and descriptions.
  • Display enchantment names and levels using Roman numerals when possible.
  • Books must be obtainable through administrator commands.
  • Administrators can configure whether custom books can be used in anvils.
  • Prevent unauthorized duplication and exploitation.
  • Enchanted books must retain their custom enchantment data after restarting the server.
  1. GUI System

Create an interactive enchantment GUI.

Command: "/ce gui"

GUI features:

  • Display all custom enchantments.
  • Show enchantment descriptions.
  • Show maximum levels.
  • Allow players to view their enchanted equipment.
  • Optional player enchantment purchase system using Vault economy.
  • Administrators can manage enchantments through a separate GUI.
  1. Permissions
  • "hkmc.enchants.use"
  • "hkmc.enchants.gui"
  • "hkmc.enchants.admin"
  • "hkmc.enchants.give"
  • "hkmc.enchants.enchant"
  • "hkmc.enchants.remove"
  • "hkmc.enchants.reload"
  • "hkmc.enchants.maxlevel"

Default permissions must be configured securely.

  1. Configuration

Create a fully customizable config.yml.

Administrators must be able to configure:

  • Maximum level for every enchantment.
  • Damage multipliers.
  • Damage reduction.
  • Mining speed multipliers.
  • Drop multipliers.
  • Fire duration.
  • Enchantment compatibility.
  • Anvil support.
  • GUI settings.
  • Messages.
  • Permission requirements.
  • Performance and anti-exploit limits.
  1. Important Technical Requirements
  • Do not rely on vanilla enchantment level limits.
  • Store custom enchantment levels using PersistentDataContainer or another reliable persistent storage mechanism.
  • Implement custom enchantment effects through appropriate Paper events and APIs.
  • Handle extremely high levels safely.
  • Avoid integer overflow and excessive calculations.
  • Prevent item duplication exploits.
  • Prevent conflicts with other plugins.
  • Ensure custom enchantments work after server restarts.
  • Do not use unsafe NBT manipulation.
  • Do not crash when players use enchanted items in anvils, grindstones, crafting tables, or inventories.
  • Make the plugin compatible with Java and Bedrock clients.
  1. Deliverables

Generate the entire project, including:

  1. Complete Java source code.
  2. Main plugin class.
  3. Custom enchantment manager.
  4. Enchantment effect handlers.
  5. Command system.
  6. GUI system.
  7. Permission management.
  8. config.yml.
  9. plugin.yml.
  10. Gradle build files.
  11. README with installation instructions.

Provide exact step-by-step instructions to build the plugin and install the resulting JAR on my Paper 26.2 server.

IMPORTANT: Do not provide incomplete code, pseudocode, or placeholder methods. Generate a fully working plugin with all source files. Verify API compatibility with Paper 26.2 and Java 25. Build and test the complete project before declaring it finished.

Kodari AI
KodariNov 1 at 9:27 am 2
HKMCCustomEnchants
A comprehensive Paper plugin implementing a custom enchantment system supporting levels up to 2000. Features configurable enchantment mechanics including damage multipliers, protection reduction, mining speed boosts, drop rates, fire duration, and durability preservation. Includes a GUI system for browsing and purchasing enchantments with Vault economy integration, command suite for administration, persistent enchantment storage via PersistentDataContainer, and full configuration for all gameplay parameters. Designed for Java and Bedrock clients with Geyser compatibility, featuring anti-exploit protections and safe handling of extreme enchantment levels.
  1. Set up the Java 25 Gradle project and Paper plugin metadata.

  2. Implement persistent custom enchantments, bounded gameplay effects, commands, and protections for anvil/grindstone/crafting use.

  3. Add player and administrator GUIs, configurable mechanics/messages, and installation instructions.

Created HKMCCustomEnchants with persistent custom enchantments, configurable level caps and effects, commands, enchanted books, anvil support, exploit safeguards, and player/admin GUIs. Paper API 26.2 and Java 25 are configured in build.gradle; the README documents the features and setup.

Efficiency uses a configurable level threshold for instant breaking rather than a gradual mining-speed multiplier. The GUI is informational; the optional Vault purchase system is not included. I can’t claim a live Paper 26.2 server test from this workspace.

Build and install

  1. On desktop, click Compile in the top bar. On phone, tap ⋮ → Compile Project.

  2. Click Compile in the window that opens.

  3. After a successful build, click Download on the build or Download HKMCCustomEnchants.jar in chat.

  4. Stop your server, upload the JAR to its plugins folder, then start the server. Configure plugins/HKMCCustomEnchants/config.yml; apply changes with /ce reload.

Lex Luther

Improve the existing HKMCCustomEnchants project.

  1. Implement the missing Vault economy purchasing system.
  2. Make the player GUI fully functional.
  3. Make Efficiency use gradual configurable mining-speed multipliers instead of only instant breaking thresholds.
  4. Add complete support for all configured enchantments up to level 2000.
  5. Verify every command and permission.
  6. Check item duplication exploits involving anvils, grindstones, crafting and inventories.
  7. Run a complete Gradle build and fix all compilation errors.
  8. Do not remove existing working features.
  9. Do not use placeholder methods or pseudocode.
  10. Provide a detailed list of implemented features and known limitations.

Do not claim live server testing unless it was actually performed.

Kodari AI
KodariNov 1 at 11:00 am 7
  1. Implement Vault-backed enchantment purchases in the existing player GUI.

  2. Make GUI actions functional and replace Efficiency thresholds with gradual speed multipliers.

  3. Audit configured enchantment coverage, command permissions, and item-transfer exploit handling.

  4. Run the available Gradle build and fix compilation issues.

  5. Summarize implemented behavior and verified limitations.

Implemented the Vault purchasing flow, functional enchantment menus, gradual Efficiency scaling, and permission/data-cap fixes. The Gradle build is not verified: this workspace does not provide a Gradle executable, so I did not run a build or claim a compile pass. No live Paper or Geyser/Floodgate server test was performed.

Implemented

  • Vault purchases: /ce gui players can click an enchantment to upgrade a compatible item in their main hand. Prices are configurable globally or per enchantment; purchase levels per click are configurable. Payment failures are handled, and a failed enchantment application triggers a refund attempt.

  • Optional Vault integration: Vault is a soft dependency. Without Vault or a registered economy provider, the plugin’s other features remain available and purchases are disabled.

  • Functional GUIs: The player menu shows enchantments, caps, held-item levels, and equipped gear; clicks purchase upgrades. The admin menu retains click-to-adjust level caps, with permission checks on menu clicks.

  • Gradual Efficiency: Mining speed scales per level with configurable base, per-level, and maximum multipliers. The optional instant-break threshold remains available but is disabled by default. The prior player speed value is restored on switching to a non-Efficiency item, quitting, or plugin disable.

  • Level caps: Reading an item’s enchantment level now respects that enchantment’s configured maximum as well as the global cap.

  • Command permissions: Help and version now also check hkmc.enchants.use. Other command permissions are checked against the nodes declared in plugin.yml; administrative and modifying nodes default to operators.

  • Safety review: Existing anvil, grindstone, and crafting safeguards remain in place. The reviewed handlers did not reveal a provable duplication path; this was a code review, not an exploit test.

  • Documentation/dependencies: Added the compile-only Vault API dependency and updated the README with setup, purchasing, and limitations.

Known limitations

  • Purchases require Vault and an economy provider, and apply to the item in the player’s main hand. They do not purchase books.

  • Custom enchantments are stored in item persistent data and are not native Minecraft enchantments. Other plugins or vanilla systems that only inspect native enchantments will not recognize them; this plugin handles its configured effects and custom-book anvil application.

  • Efficiency changes a player-level Paper mining-speed setting. Another plugin changing that same setting while custom Efficiency is active may have its value superseded until restoration.

  • Effective custom levels are capped at 2,000 globally, even if an enchantment’s configured cap is higher.

  • A completed Gradle compile and runtime behavior on Paper 26.2 remain unverified.

To run Kodari’s build check: click Compile in the desktop top bar, or on phone tap ⋮ → Compile Project, then click Compile in the build window.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
README.md
settings.gradle
Code
14 1,694
src/main/java/com/hkmc/customenchants/HKMCCustomEnchants.java
package com.hkmc.customenchants;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.entity.Player;

public final class HKMCCustomEnchants extends JavaPlugin {
    private EnchantmentManager enchantmentManager;
    private EnchantItemService itemService;
    private EnchantmentListener enchantmentListener;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        enchantmentManager = new EnchantmentManager(this);
        itemService = new EnchantItemService(enchantmentManager);
        EconomyService economy = setupEconomy();
        enchantmentListener = new EnchantmentListener(this, enchantmentManager, itemService);
        EnchantmentGui gui = new EnchantmentGui(this, enchantmentManager, economy);
        Bukkit.getPluginManager().registerEvents(enchantmentListener, this);
        Bukkit.getPluginManager().registerEvents(gui, this);
        EnchantmentCommand command = new EnchantmentCommand(this, enchantmentManager, itemService, gui);
        getCommand("ce").setExecutor(command);
        getCommand("ce").setTabCompleter(command);
        getLogger().info("HKMCCustomEnchants enabled with " + EnchantmentType.values().length + " enchantments.");
    }

    @Override
    public void onDisable() {
        if (enchantmentListener != null) {
            for (Player player : Bukkit.getOnlinePlayers()) {
                enchantmentListener.restoreEfficiencySpeed(player);
            }
        }
    }

    private EconomyService setupEconomy() {
        if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
            return null;
        }
        EconomyService economy = VaultEconomyService.hook(this);
        if (economy == null) {
            getLogger().warning("Vault is installed, but no economy provider was found; GUI purchases are disabled.");
        }
        return economy;
    }

    public EnchantmentManager enchantments() {
        return enchantmentManager;
    }

    public EnchantItemService itemService() {
        return itemService;
    }
}