svoen7

Create a Minecraft Java Edition Paper/Spigot plugin for Minecraft 1.21.1 named NoMaceEnchants.

The plugin must completely disable the Density and Breach enchantments from the game so they cannot be used on a Mace in any way.

Requirements:

Compatible with Paper/Spigot 1.21.1 Written in Java Use proper plugin structure with plugin.yml Maven or Gradle project setup preferred The plugin must:

Prevent players from obtaining Density or Breach enchantments through:

Enchanting tables Anvils Villager trades Loot generation Creative inventory Commands like /give, /enchant, or NBT-edited items Grindstones or any exploit Automatically remove Density and Breach enchantments from any Mace item when:

A player joins the server A player picks up an item An inventory is opened An item is crafted or modified An item is held in hand Prevent enchanted books containing Density or Breach from existing:

Remove the enchantments from books Cancel creation of those books if needed Include configurable messages in a config.yml file:

Message when a forbidden enchantment is removed Toggle admin notifications Include permissions: nomaceenchants.bypass → players with this permission are exempt Optimize performance:

Avoid unnecessary loops Use efficient event listeners No console spam Add clean logging on startup:

Confirm plugin enabled Confirm enchantments blocked Include:

Full source code plugin.yml config.yml Main plugin class Event listener classes Build instructions Use modern Paper API practices for Minecraft 1.21.1.

The plugin should fail safely if Minecraft changes enchantment IDs in future updates.

Kodari AI
KodariMay 27 at 6:23 am 17,888 (v2)

I’ll create a comprehensive plugin that blocks Density and Breach enchantments from Maces in Minecraft 1.21.1.

NoMaceEnchants
A Minecraft 1.21.1 plugin that completely blocks Density and Breach enchantments from being used on Maces. Prevents enchantment acquisition through all methods (enchanting tables, anvils, villager trades, loot, creative, commands), automatically removes forbidden enchantments from items, and includes configurable messages with bypass permissions. Optimized for performance with clean logging and fail-safe design.

Summary

Created NoMaceEnchants - a comprehensive Minecraft 1.21.1 plugin that completely blocks Density and Breach enchantments on Maces.

Structure:

  • Main Plugin: Initializes managers and registers listeners

  • ConfigManager: Handles all configuration reading with color-coded messages

  • EnchantmentRemover: Core utility that checks and removes forbidden enchantments

  • 3 Event Listeners:

    • EnchantmentBlockListener - Blocks enchanting, anvils, commands, crafting

    • ItemCheckListener - Auto-checks on join, pickup, inventory open, item held, creative mode

    • VillagerTradeListener - Prevents villager trades with blocked enchants

Key Features: ✅ Blocks all acquisition methods (enchanting tables, anvils, villagers, loot, creative, commands)
✅ Auto-removes from existing items (join, pickup, open inventory, hold, craft)
✅ Removes from enchanted books (converts to regular book if empty)
✅ Permission bypass: nomaceenchants.bypass
✅ Fully configurable messages and behavior
✅ Performance optimized with efficient event handling
✅ Fail-safe design for future Minecraft updates
✅ Clean startup logging

Build: ./gradlew build → outputs to build/libs/NoMaceEnchants-1.0.0.jar

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
README.md
Code
10 807
src/main/java/com/nomaceenchants/NoMaceEnchants.java
package com.nomaceenchants;

import com.nomaceenchants.config.ConfigManager;
import com.nomaceenchants.listeners.EnchantmentBlockListener;
import com.nomaceenchants.listeners.ItemCheckListener;
import com.nomaceenchants.listeners.VillagerTradeListener;
import com.nomaceenchants.utils.EnchantmentRemover;
import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

public class NoMaceEnchants extends JavaPlugin {
    
    private ConfigManager configManager;
    private EnchantmentRemover enchantmentRemover;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.configManager = new ConfigManager(this);
        this.enchantmentRemover = new EnchantmentRemover(this);
        
        registerListeners();
        
        getLogger().info("NoMaceEnchants enabled successfully!");
        getLogger().info("Blocking enchantments: DENSITY, BREACH");
        getLogger().info("Target item: MACE");
    }
    
    @Override
    public void onDisable() {
        getLogger().info("NoMaceEnchants disabled.");
    }
    
    private void registerListeners() {
        PluginManager pm = Bukkit.getPluginManager();
        
        pm.registerEvents(new EnchantmentBlockListener(this), this);
        pm.registerEvents(new ItemCheckListener(this), this);
        pm.registerEvents(new VillagerTradeListener(this), this);
    }
    
    public ConfigManager getConfigManager() {
        return configManager;
    }
    
    public EnchantmentRemover getEnchantmentRemover() {
        return enchantmentRemover;
    }
}