Miguel Bautista

Create a Paper 1.21.x Minecraft plugin called EnchainSMP.

The main feature is that any enchantment can be applied to any item, while keeping vanilla max levels.

Core Features

Every 15 minutes, every online player receives 1 random enchantment book.

The enchantment is different for every player.

Each enchantment can only be given once to a player until they have collected them all.

After collecting every enchantment, the pool resets automatically.

The book should display the enchantment name and its vanilla level.

Enchanting System

Players can combine the random enchantment book with any item in an anvil.

Ignore vanilla item restrictions (Sharpness on sticks, Protection on helmets, etc.).

Never exceed vanilla limits:

Sharpness V

Protection IV

Unbreaking III

Mending I

etc.

Do not create illegal levels like Sharpness X or Fortune X.

Spear Compatibility

Riptide must fully work on custom spear items.

The spear should behave like a trident for Riptide while still being a spear.

Loyalty, Channeling, and Impaling should also function correctly on spears.

Universal Item Support

Any enchantment should work on any item:

Weapons

Tools

Armor

Blocks

Food

Custom items

Preserve all enchantment effects whenever possible.

Commands

/enchain reload — reload config

/enchain give — give a specific enchant book

/enchain reset — reset collected enchantments

Config

Change reward interval (default 900 seconds)

Enable/disable broadcast messages

Customize messages

Support permissions

The code should be clean, optimized, and ready to compile as a Paper plugin with no enchantment level exceeding vanilla limits.

Kodari AI
KodariOct 17 at 6:06 am 1
EnchainSMP
EnchainSMP is a Paper 1.21.x plugin that revolutionizes Minecraft enchanting by allowing any enchantment to be applied to any item while strictly enforcing vanilla level caps. Every 15 minutes, each online player receives a unique random enchantment book, with the pool resetting after all enchantments are collected. The plugin includes a specialized spear system where Riptide, Loyalty, Channeling, and Impaling function correctly on custom spear items. Features include an anvil-based combination system that bypasses vanilla item restrictions, comprehensive commands for reloading config, giving specific enchant books, and resetting collected enchantments. Fully configurable reward intervals, broadcast messages, and permission support ensure server administrators have complete control over the enchanting experience.
  1. Set up the Paper 1.21.x project, plugin metadata, and configurable messages.

  2. Add persistent, unique enchantment rewards with vanilla-max levels.

  3. Handle unrestricted anvil application and trident-style spear behavior.

  4. Register /enchain reload, give, and reset with permissions.

Created EnchainSMP with persistent per-player enchantment collections, unique rewards among online players each cycle, configurable reward timing and messages, and the /enchain reload, give, and reset commands.

Reward books apply through anvils to any item, with enchantment levels capped at vanilla maximums. Spear items whose material key contains spear use trident projectiles for Loyalty, Channeling, and Impaling, and Riptide propulsion when wet.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
8 603
src/main/java/com/enchainsmp/EnchainSMP.java
package com.enchainsmp;

import com.enchainsmp.command.EnchainCommand;
import com.enchainsmp.enchant.EnchantmentBookService;
import com.enchainsmp.listener.EnchantingListener;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;

public final class EnchainSMP extends JavaPlugin {
    private EnchantmentBookService bookService;
    private BukkitTask rewardTask;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        bookService = new EnchantmentBookService(this);
        Bukkit.getPluginManager().registerEvents(new EnchantingListener(bookService), this);

        PluginCommand command = getCommand("enchain");
        if (command != null) {
            command.setExecutor(new EnchainCommand(this, bookService));
        }
        scheduleRewards();
    }

    @Override
    public void onDisable() {
        if (rewardTask != null) {
            rewardTask.cancel();
        }
        if (bookService != null) {
            bookService.save();
        }
    }

    public void reloadPlugin() {
        reloadConfig();
        scheduleRewards();
    }

    private void scheduleRewards() {
        if (rewardTask != null) {
            rewardTask.cancel();
        }
        long intervalTicks = Math.max(1L, getConfig().getLong("reward-interval-seconds", 900L)) * 20L;
        rewardTask = Bukkit.getScheduler().runTaskTimer(this,
                () -> bookService.giveRewards(Bukkit.getOnlinePlayers()), intervalTicks, intervalTicks);
    }
}