whoforgot

Can you make me a minecraft plugin (1.21.11) that clears netherite armor from inventories once made and gives back the materials used and admins have a command that can allow players to use netherite armor(allowed players will be able to use netherite armor and make)

Kodari AI
KodariApr 21 at 3:28 am 13,961 (v2)

I’ll create a Minecraft plugin that restricts netherite armor usage with an admin permission system.

NetheriteRestrictor
A comprehensive netherite armor restriction plugin that prevents unauthorized players from crafting, obtaining, or wearing netherite armor. Automatically removes netherite armor from player inventories and refunds the crafting materials (diamond armor + netherite ingot). Features admin commands to whitelist specific players, automatic inventory scanning on join, and real-time prevention of armor pickup and smithing. Configurable messages and refund options.

Perfect! I’ve created a comprehensive netherite armor restriction plugin with the following features:

Plugin Structure:

  • NetheriteRestrictor (main class) - Manages all components

  • ConfigManager - Handles configuration and messages

  • DataManager - Stores allowed player UUIDs in data.yml

  • NetheriteListener - Prevents armor crafting, pickup, equipping, and periodically checks equipped armor

  • NetheriteCommand - Admin commands to manage permissions

Key Features:

  1. Prevents netherite armor usage from multiple sources:

    • Smithing table crafting

    • Picking up dropped armor

    • Equipping armor in slots

    • Periodic check removes equipped armor (every second by default)

  2. Automatic material refund (configurable):

    • Returns diamond armor piece + netherite ingot

    • Preserves enchantments on returned items

    • Drops items if inventory is full

  3. Admin Commands:

    • /netherite allow <player> - Whitelist a player

    • /netherite disallow <player> - Remove from whitelist

    • /netherite list - Show all allowed players

    • /netherite reload - Reload configuration

  4. Permission System:

    • netherite.admin - Use admin commands

    • netherite.bypass - Always allow netherite armor

    • Whitelisted players (stored in data.yml)

  5. Smart Features:

    • Scans inventory on player join

    • Periodic armor slot checking

    • Creative admins with proper permission can use armor

    • Fully configurable messages and refund options

The plugin uses XSeries for cross-version compatibility and includes proper event handling for all scenarios where players might obtain netherite armor.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
8 710
src/main/java/com/netheriterestrictor/NetheriteRestrictor.java
package com.netheriterestrictor;

import com.netheriterestrictor.command.NetheriteCommand;
import com.netheriterestrictor.config.ConfigManager;
import com.netheriterestrictor.data.DataManager;
import com.netheriterestrictor.listener.NetheriteListener;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class NetheriteRestrictor extends JavaPlugin {
    private ConfigManager configManager;
    private DataManager dataManager;
    private NetheriteListener netheriteListener;

    @Override
    public void onEnable() {
        this.configManager = new ConfigManager(this);
        this.dataManager = new DataManager(this);
        
        this.netheriteListener = new NetheriteListener(this);
        Bukkit.getPluginManager().registerEvents(netheriteListener, this);
        
        NetheriteCommand command = new NetheriteCommand(this);
        getCommand("netherite").setExecutor(command);
        getCommand("netherite").setTabCompleter(command);
        
        startArmorCheckTask();
        
        getLogger().info("NetheriteRestrictor has been enabled!");
    }

    @Override
    public void onDisable() {
        if (dataManager != null) {
            dataManager.save();
        }
        getLogger().info("NetheriteRestrictor has been disabled!");
    }
    
    private void startArmorCheckTask() {
        long interval = configManager.getCheckInterval();
        Bukkit.getScheduler().runTaskTimer(this, () -> {
            netheriteListener.checkAllPlayersArmor();
        }, interval, interval);
    }
    
    public void reload() {
        configManager.reload();
        dataManager.reload();
    }
}