Leo

make a plugin called NiceEdit where you can type /ne or /NiceEdit for the start and that will bring you into an editor where you can pick entities or items, in entities there is stuff like giving them armour and right click the armour to go into the enchant, effect or attribute editor, the attribute has every attribute in the game and you can choose how much of the attribute you want and you can choose what slot you want it to come in effect with, the enchant and effect editor are pretty self explanatory but its basically just choosing the enchant/effect and what level you want it to be, in the enchant editor there is also an option to make the item or entity unbreakable and unkillable, in the items section its basically the same, but you can make the player glow a colour when the item is in their inventory so it will be like the glow effect that goes away when you lose the item but the glow outline will glow a colour, you can also make the enchants any level up to 255, you can also add coloured names to an item with a rename menu with an option for gradients and different texts like obfuscated or mini, you can also make items consumable in its own menu and choose to give it an effect when you eat it, how much saturation you get and if it can cure a zombie villager or not. you can also add particles when you have an item in your inventory so it has every particle in the game available, you can also make it so the particles are not visible when the person holding the item is in first person.

Kodari AI
KodariOct 25 at 6:35 pm 3
NiceEdit
NiceEdit is a comprehensive item and entity editor plugin. Players type /ne or /NiceEdit to open a GUI-based editor where they can select entities or items. The entity editor allows equipping armor with right-click access to enchant, effect, and attribute editors. The attribute editor features every attribute in the game with configurable values and slot-specific effects. The enchant editor supports levels up to 255, unbreakable items, and unkillable entities. The item editor includes colored names with gradients and formatting, consumable item settings with saturation and zombie villager curing options, and a particle system with every particle type available, including a first-person visibility toggle. The plugin also enables a colored glow effect on players holding specific items, with the glow disappearing when the item is removed.
  1. Create the NiceEdit plugin scaffold and /ne / /NiceEdit entry point.

  2. Add GUI editors for nearby entities, armor, and inventory items, with chat prompts for values.

  3. Store item settings in persistent data and apply consumables, glow colors, and particles in-game.

Created NiceEdit with /ne and /niceedit.

  • Choose a nearby living entity to edit its armor, attributes, effects, and invulnerability. Right-click equipped armor in the editor to modify it.

  • Choose an inventory item to edit enchantments (levels 1–255), slot-specific attributes, MiniMessage names, consumable settings, glow color, and particles.

  • Item settings persist as metadata. Custom consumables can apply effects, restore food and saturation, or start curing a nearby zombie villager. Armor effects apply while worn.

The project scaffold targets Paper 1.21.4 and Java 21.

Leo

make it 1.21.11

Kodari AI
KodariOct 25 at 6:36 pm 1
  • Update the Paper API dependency to 1.21.11.

  • Set the plugin’s declared API version to 1.21.11.

Updated NiceEdit to target Paper 1.21.11 in build.gradle and declared api-version: '1.21.11' in plugin.yml.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
3 956
src/main/java/com/kodari/niceedit/NiceEditPlugin.java
package com.kodari.niceedit;

import com.cryptomorin.xseries.XAttribute;
import com.cryptomorin.xseries.XEnchantment;
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XPotion;
import com.cryptomorin.xseries.particles.XParticle;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.NamespacedKey;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.ZombieVillager;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;

public final class NiceEditPlugin extends JavaPlugin implements Listener {
    private static final String[] ENCHANTMENTS = {
            "AQUA_AFFINITY", "BANE_OF_ARTHROPODS", "BINDING_CURSE", "BLAST_PROTECTION", "BREACH",
            "CHANNELING", "DENSITY", "DEPTH_STRIDER", "EFFICIENCY", "FEATHER_FALLING", "FIRE_ASPECT",
            "FIRE_PROTECTION", "FLAME", "FORTUNE", "FROST_WALKER", "IMPALING", "INFINITY", "KNOCKBACK",
            "LOOTING", "LOYALTY", "LUCK_OF_THE_SEA", "LURE", "MENDING", "MULTISHOT", "PIERCING",
            "POWER", "PROJECTILE_PROTECTION", "PROTECTION", "PUNCH", "QUICK_CHARGE", "RESPIRATION",
            "RIPTIDE", "SHARPNESS", "SILK_TOUCH", "SMITE", "SOUL_SPEED", "SWEEPING_EDGE", "SWIFT_SNEAK",
            "THORNS", "UNBREAKING", "VANISHING_CURSE", "WIND_BURST"
    };
    private static final String[] EFFECTS = {
            "ABSORPTION", "BAD_OMEN", "BLINDNESS", "CONDUIT_POWER", "DARKNESS", "DOLPHINS_GRACE",
            "FIRE_RESISTANCE", "GLOWING", "HASTE", "HEALTH_BOOST", "HERO_OF_THE_VILLAGE", "HUNGER",
            "INSTANT_DAMAGE", "INSTANT_HEALTH", "INVISIBILITY", "JUMP_BOOST", "LEVITATION", "LUCK",
            "MINING_FATIGUE", "NAUSEA", "NIGHT_VISION", "POISON", "REGENERATION", "RESISTANCE",
            "SATURATION", "SLOW_FALLING", "SLOWNESS", "SPEED", "STRENGTH", "TRIAL_OMEN", "UNLUCK",
            "WATER_BREATHING", "WEAKNESS", "WEAVING", "WIND_CHARGED", "WITHER"
    };
    private static final String[] ATTRIBUTES = {
            "ARMOR", "ARMOR_TOUGHNESS", "ATTACK_DAMAGE", "ATTACK_KNOCKBACK", "ATTACK_SPEED",
            "BLOCK_BREAK_SPEED", "BLOCK_INTERACTION_RANGE", "BURNING_TIME", "ENTITY_INTERACTION_RANGE",
            "EXPLOSION_KNOCKBACK_RESISTANCE", "FALL_DAMAGE_MULTIPLIER", "FLYING_SPEED", "FOLLOW_RANGE",
            "GRAVITY", "JUMP_STRENGTH", "KNOCKBACK_RESISTANCE", "LUCK", "MAX_ABSORPTION", "MAX_HEALTH",
            "MAX_AIR", "MOVEMENT_EFFICIENCY", "MOVEMENT_SPEED", "OXYGEN_BONUS", "SAFE_FALL_DISTANCE",
            "SCALE", "STEP_HEIGHT", "WATER_MOVEMENT_EFFICIENCY", "WAYPOINT_RECEIVE_RANGE",
            "WAYPOINT_TRANSMIT_RANGE"
    };
    private static final String[] PARTICLES = {
            "ANGRY_VILLAGER", "ASH", "BLOCK", "BLOCK_MARKER", "BUBBLE", "BUBBLE_COLUMN_UP", "BUBBLE_POP",
            "CAMPFIRE_COSY_SMOKE", "CAMPFIRE_SIGNAL_SMOKE", "CHERRY_LEAVES", "CLOUD", "COMPOSTER",
            "CRIT", "CURRENT_DOWN", "DAMAGE_INDICATOR", "DOLPHIN", "DRAGON_BREATH", "DRIPPING_CHERRY_LEAVES", "DRIPPING_DRIPSTONE_LAVA",
            "DRIPPING_DRIPSTONE_WATER", "DRIPPING_HONEY", "DRIPPING_LAVA", "DRIPPING_OBSIDIAN_TEAR",
            "DRIPPING_WATER", "DUST", "DUST_COLOR_TRANSITION", "EFFECT", "ELDER_GUARDIAN", "ENCHANT",
            "ENCHANTED_HIT", "END_ROD", "ENTITY_EFFECT", "EXPLOSION", "EXPLOSION_EMITTER", "FALLING_DUST",
            "FALLING_CHERRY_LEAVES", "FALLING_HONEY", "FALLING_LAVA", "FALLING_NECTAR", "FALLING_OBSIDIAN_TEAR", "FALLING_WATER",
            "FIREWORK", "FIRE_FLAME", "FLAME", "FLASH", "GLOW", "GLOW_SQUID_INK", "GUST", "GUST_DUST",
            "GUST_EMITTER_LARGE", "GUST_EMITTER_SMALL", "HAPPY_VILLAGER", "HEART", "INFESTED", "INSTANT_EFFECT", "ITEM",
            "ITEM_COBWEB", "ITEM_SLIME", "ITEM_SNOWBALL", "LANDING_CHERRY_LEAVES", "LANDING_HONEY", "LANDING_LAVA", "LANDING_OBSIDIAN_TEAR",
            "LARGE_SMOKE", "LAVA", "MYCELIUM", "NAUTILUS", "NOTE", "OMINOUS_SPAWNING", "POOF", "PORTAL",
            "RAIN", "SCRAPE", "SCULK_CHARGE", "SCULK_CHARGE_POP", "SCULK_SOUL", "SCULK_SOUL_CHARGE",
            "SCULK_SOUL_CHARGE_POP", "SCULK_SPORE", "SHRIEK", "SMALL_FLAME", "SMALL_GUST", "SNOWFLAKE",
            "SMOKE", "SNEEZE", "SONIC_BOOM", "SPLASH", "SPORE_BLOSSOM_AIR", "SQUID_INK", "SWEEP_ATTACK", "TOTEM_OF_UNDYING",
            "TRAIL", "TRIAL_OMEN", "TRIAL_SPAWNER_DETECTION", "TRIAL_SPAWNER_DETECTION_OMINOUS", "VIBRATION",
            "TURTLE_EGG", "UNDERWATER", "WARPED_SPORE", "WATER_BUBBLE", "WATER_SPLASH", "WATER_WAKE", "WAX_OFF",
            "WAX_ON", "WHITE_ASH", "WHITE_SMOKE", "WITCH"
    };
    private static final String[] GLOW_COLORS = {
            "WHITE", "AQUA", "DARK_AQUA", "BLUE", "DARK_BLUE", "GREEN", "DARK_GREEN", "YELLOW", "GOLD",
            "RED", "DARK_RED", "LIGHT_PURPLE", "DARK_PURPLE", "GRAY", "DARK_GRAY", "BLACK"
    };

    private final Map<UUID, Prompt> prompts = new HashMap<>();
    private final Map<UUID, Team> previousTeams = new HashMap<>();
    private NamespacedKey itemTag;
    private NamespacedKey dataTag;
    private NamespacedKey entityTag;

    @Override
    public void onEnable() {
        itemTag = new NamespacedKey(this, "niceedit_item");
        dataTag = new NamespacedKey(this, "data");
        entityTag = new NamespacedKey(this, "target");
        Bukkit.getPluginManager().registerEvents(this, this);
        if (getCommand("niceedit") != null) {
            getCommand("niceedit").setExecutor((sender, command, label, args) -> {
                if (!(sender instanceof Player player)) {
                    sender.sendMessage("Only players can use NiceEdit.");
                    return true;
                }
                if (!player.hasPermission("niceedit.use")) {
                    message(player, "&cYou don't have permission to use NiceEdit.");
                    return true;
                }
                open(player, Mode.ROOT, null, -1, null, 0);
                return true;
            });
        }
        Bukkit.getScheduler().runTaskTimer(this, this::updateTrackedItems, 20L, 20L);
    }

    @Override
    public void onDisable() {
        for (Player player : Bukkit.getOnlinePlayers()) {
            restoreGlowTeam(player);
        }
    }

    private void open(Player player, Mode mode, LivingEntity target, int itemSlot, EquipmentSlot equipmentSlot, int page) {
        String title = switch (mode) {
            case ROOT -> "&8NiceEdit";
            case ENTITY_SELECT -> "&8Select an entity";
            case ENTITY_MENU -> "&8Entity editor";
            case ARMOR -> "&8Entity armor";
            case ARMOR_PICK -> "&8Choose armor item";
            case ITEM_SELECT -> "&8Choose an item";
            case ITEM_MENU -> "&8Item editor";
            case ENCHANTMENTS -> "&8Enchantments";
            case EFFECTS -> "&8Effects";
            case ATTRIBUTES -> "&8Attributes";
            case RENAME -> "&8Rename item";
            case CONSUMABLE -> "&8Consumable settings";
            case PARTICLES -> "&8Inventory particles";
            case GLOW -> "&8Inventory glow";
        };
        MenuHolder holder = new MenuHolder(player.getUniqueId(), mode, target, itemSlot, equipmentSlot, page);
        holder.inventory = Bukkit.createInventory(holder, 54, ChatColor.translateAlternateColorCodes('&', title));
        render(player, holder);
        player.openInventory(holder.inventory);
    }

    private void render(Player player, MenuHolder holder) {
        Inventory inventory = holder.inventory;
        inventory.clear();
        switch (holder.mode) {
            case ROOT -> {
                button(inventory, 20, "IRON_CHESTPLATE", "&bEntities", "&7Choose a nearby living entity to edit.");
                button(inventory, 24, "DIAMOND", "&bItems", "&7Choose an item from your inventory.");
            }
            case ENTITY_SELECT -> {
                List<LivingEntity> entities = nearbyEntities(player);
                int start = holder.page * 45;
                for (int i = start; i < Math.min(start + 45, entities.size()); i++) {
                    LivingEntity entity = entities.get(i);
                    ItemStack icon = namedItem("PAPER", "&e" + entity.getType().name(), "&7Click to edit this entity.");
                    ItemMeta meta = icon.getItemMeta();
                    meta.getPersistentDataContainer().set(entityTag, PersistentDataType.STRING, entity.getUniqueId().toString());
                    icon.setItemMeta(meta);
                    inventory.setItem(i - start, icon);
                }
                button(inventory, 45, "ARROW", "&ePrevious page", "&7Page " + (holder.page + 1));
                button(inventory, 49, "BARRIER", "&cBack", "&7Return to the editor.");
                button(inventory, 53, "ARROW", "&eNext page", "&7Page " + (holder.page + 1));
            }
            case ENTITY_MENU -> {
                button(inventory, 10, "IRON_CHESTPLATE", "&bArmor", "&7Equip armor or edit armor properties.");
                button(inventory, 12, "GOLDEN_CHESTPLATE", "&bAttributes", "&7Apply an attribute modifier.");
                button(inventory, 14, "POTION", "&bEffects", "&7Apply a potion effect.");
                button(inventory, 16, "TOTEM_OF_UNDYING", holder.target != null && holder.target.isInvulnerable() ? "&aUnkillable: on" : "&cUnkillable: off", "&7Click to toggle invulnerability.");
                button(inventory, 49, "ARROW", "&eBack", "&7Return to the main menu.");
            }
            case ARMOR -> {
                if (valid(holder.target) && holder.target.getEquipment() != null) {
                    armorButton(inventory, 10, holder.target, EquipmentSlot.HEAD, "&bHelmet");
                    armorButton(inventory, 12, holder.target, EquipmentSlot.CHEST, "&bChestplate");
                    armorButton(inventory, 14, holder.target, EquipmentSlot.LEGS, "&bLeggings");
                    armorButton(inventory, 16, holder.target, EquipmentSlot.FEET, "&bBoots");
                }
                button(inventory, 49, "ARROW", "&eBack", "&7Return to entity editor.");
            }
            case ARMOR_PICK, ITEM_SELECT -> {
                PlayerInventory playerInventory = player.getInventory();
                for (int i = 0; i < 36; i++) {
                    ItemStack item = playerInventory.getItem(i);
                    if (item != null && !item.getType().isAir()) inventory.setItem(i, item.clone());