Kakali Sadhukhan

You are an expert Minecraft Paper plugin developer.

Build a COMPLETE, PRODUCTION-READY Minecraft plugin named:

LegendaryWeaponsSMP

Target exactly:

  • Minecraft: 1.21.11
  • Server: Paper 1.21.11
  • Java: 21
  • Build system: Maven
  • Paper API: 1.21.11-R0.1-SNAPSHOT
  • Plugin type: Standard Bukkit/Paper plugin using "plugin.yml"
  • Do NOT target Minecraft 26.x.
  • Do NOT use APIs introduced after Minecraft 1.21.11.
  • Do NOT use deprecated or incompatible APIs from newer Minecraft versions.

The project must compile and produce a working ".jar".

Use Paper's official Maven repository and the 1.21.11 API dependency. Paper's 1.21.11-era API uses the "1.21.11-R0.1-SNAPSHOT" version format.

---

ABSOLUTE REQUIREMENT

Do NOT give me a tutorial.

Do NOT give me pseudo-code.

Do NOT give me incomplete examples.

Do NOT create placeholder methods.

Do NOT write:

// TODO // implement later return null;

Do NOT leave abilities as dummy methods.

I want the COMPLETE SOURCE CODE of the plugin.

Every class must contain real working implementation.

After generating the project, verify that:

mvn clean package

works without compilation errors.

If an API method is incompatible with Paper 1.21.11, replace it with the correct 1.21.11 API implementation.

---

PROJECT INFORMATION

Plugin name:

"LegendaryWeaponsSMP"

Main package:

"me.legendaryweapons.smp"

Main class:

"LegendaryWeaponsPlugin"

Plugin version:

"1.0.0"

Java:

"21"

Minecraft:

"1.21.11"

---

8 LEGENDARY WEAPONS

There must be EXACTLY 8 legendary weapons.

  1. CROWN BREAKER

Type:

Mace

Theme:

Golden / Royal / Legendary / Destruction

---

  1. VOID REAPER

Type:

Sword

Theme:

Void / Darkness / Soul

---

  1. INFERNO EDGE

Type:

Sword

Theme:

Fire / Lava / Destruction

---

  1. THUNDER FANG

Type:

Sword

Theme:

Lightning / Storm / Speed

---

  1. FROSTBANE

Type:

Sword

Theme:

Ice / Frost / Control

---

  1. BLOODTHORN

Type:

Spear

Theme:

Blood / Dark Nature / Life Steal

Because Minecraft 1.21.11 does not provide a vanilla spear weapon, implement Bloodthorn as a custom weapon using a suitable vanilla base item and custom resource-pack model. Do NOT pretend it is a vanilla spear.

---

  1. CELESTIAL RUIN

Type:

Powerful Bow

Theme:

Cosmic / Divine / Celestial

This must be a genuinely powerful custom bow with custom projectile mechanics.

---

  1. ABYSSAL TRIDENT

Type:

Trident

Theme:

Abyss / Ocean / Water

Use the actual Minecraft Trident as the base item, enhanced with custom abilities and resource-pack visuals.

---

WEAPON IDENTIFICATION

Never identify weapons using display name alone.

Every legendary weapon must use PersistentDataContainer.

Use keys such as:

legendaryweapons:weapon_id legendaryweapons:weapon_level legendaryweapons:weapon_rarity legendaryweapons:owner_uuid

Example:

weapon_id = crown_breaker

A player changing the name of a normal Mace must NOT turn it into Crown Breaker.

A player changing the lore of a normal sword must NOT turn it into Void Reaper.

---

RARITY SYSTEM

Every weapon has:

"LEGENDARY"

Use a visually strong item name.

Example:

§6§lCROWN BREAKER §8Legendary Mace

Use MiniMessage/Adventure components internally where supported.

---

WEAPON ABILITY SYSTEM

Every weapon MUST have:

Passive Ability

Always active or triggered by combat.

Primary Ability

Default right-click ability.

Secondary Ability

Default sneak + right-click.

Ultimate Ability

Default sneak + left-click.

However, ability activation must be configurable.

Crown Breaker's Soul Reaper specifically MUST use right-click as requested below.

---

==========================================

CROWN BREAKER

==========================================

Crown Breaker is the most important weapon.

Base item:

MACE

It must use actual Minecraft Mace behavior wherever possible.

Visual:

Golden/yellow custom Mace, based on the supplied Crown Breaker reference.

Do NOT use the exact copyrighted texture from someone else's resource pack.

Create an original custom texture/model inspired by the supplied reference:

  • golden/yellow
  • royal
  • heavy
  • legendary
  • glowing energy
  • unique head
  • powerful silhouette

---

CROWN BREAKER ABILITY 1

CROWN'S MIGHT

This is the normal damage-boosting ability.

When activated:

  • Increase player's damage.
  • Apply golden aura.
  • Spawn golden particles around player.
  • Play activation sound.
  • Show action bar.
  • Add configurable duration.
  • Add configurable cooldown.

Example:

§6⚔ CROWN'S MIGHT ACTIVATED

Configuration:

crown_breaker: crown_might: enabled: true damage_multiplier: 1.50 duration_seconds: 10 cooldown_seconds: 30

The actual damage calculation must work.

Do NOT merely show a message.

The ability must actually modify outgoing damage.

Make sure the multiplier does not stack infinitely.

When the ability expires, restore normal damage.

---

CROWN BREAKER ABILITY 2

SOUL REAPER

This is the signature Crown Breaker ability.

Activation:

RIGHT CLICK with Crown Breaker.

When activated:

  • Player can temporarily fly/float through the air.
  • Do NOT give permanent Creative flight.
  • Use temporary controlled movement.
  • Allow the player to rise/fall/move while ability is active.
  • Add configurable flight duration.
  • Add configurable movement speed.
  • Add cooldown.
  • Prevent fall damage caused by the ability.

Configuration:

crown_breaker: soul_reaper: duration_seconds: 8 flight_speed: 0.8 cooldown_seconds: 25 fall_damage_protection: true

Visual effects:

  • golden particles
  • soul particles
  • smoke
  • rotating aura
  • trailing particles
  • energy around the Mace
  • flight trail

Sounds:

  • activation sound
  • looping/ambient sound if practical
  • ending sound

Action bar:

§6Soul Reaper §7| §e8.0s

When finished:

  • remove temporary flight state
  • restore previous flight state
  • restore normal movement
  • remove temporary effects
  • prevent accidental fall damage
  • play ending sound

Handle:

  • logout
  • death
  • teleport
  • world change
  • plugin reload

so the player never becomes permanently stuck in flight.

---

CROWN BREAKER SOUL REAPER DOWNWARD ATTACK

This is the main combat mechanic.

While Soul Reaper is active, the player can move/fly above enemies.

When the player performs a downward Mace strike:

Detect a valid enemy/player below the Crown Breaker user.

Create a powerful impact.

Requirements:

DAMAGE

Deal a large configurable amount of damage.

Example:

soul_reaper_attack: damage: 30.0

Do not hard-code the value.

KNOCKBACK

Apply strong downward/sideways impact knockback.

Configurable:

knockback: 2.0

SHOCKWAVE

Create a large expanding golden shockwave.

GROUND IMPACT

Create:

  • dust
  • explosion
  • golden particles
  • Mace impact particles
  • expanding rings
  • radial particles

SOUND

Play:

  • heavy Mace impact
  • explosion
  • custom secondary impact sound

---

CROWN BREAKER SPECIAL TOTEM MECHANIC

This is REQUIRED.

When Crown Breaker's Soul Reaper downward attack successfully hits a player:

Find nearby players within a configurable radius.

Example:

totem_break_radius: 10.0

For nearby affected players:

If they have a Totem of Undying and are in a valid Totem-use position:

trigger the Totem mechanic.

The implementation must use the actual Minecraft Totem mechanics where possible instead of simply deleting the item.

The Totem activation should:

  • trigger the normal Totem animation
  • consume/break the Totem
  • show Totem particles
  • play Totem sound
  • then apply the Crown Breaker special damage

If direct Totem triggering is not exposed safely by Paper API, implement the safest 1.21.11-compatible equivalent:

  1. Detect the Totem.
  2. Consume the appropriate Totem.
  3. Produce the Totem activation visuals/sound.
  4. Apply the configured special damage/effect.

DO NOT use NMS unless absolutely necessary.

If NMS is required, isolate it inside a dedicated compatibility class and target ONLY Paper 1.21.11.

---

CROWN BREAKER SPECIAL DAMAGE

After the Totem trigger/break:

Apply very high configurable damage.

Example:

totem_damage: enabled: true damage: 35.0 radius: 10.0

Do NOT allow this to recursively trigger itself.

Use an internal damage cause/tag:

CROWN_BREAKER_TOTEM_DAMAGE

so the damage system knows it is special damage.

---

CROWN BREAKER VISUAL SEQUENCE

On successful downward strike:

  1. Detect target.
  2. Freeze/slow visual moment for a very short time if configured.
  3. Create golden circle.
  4. Create expanding ring.
  5. Create Mace impact.
  6. Create vertical golden beam.
  7. Create Totem particles around affected players.
  8. Play heavy impact sound.
  9. Apply damage.
  10. Apply knockback.
  11. Play final explosion.
  12. Create final shockwave.

This must feel like a LEGENDARY ultimate attack.

---

CROWN BREAKER COOLDOWN

Crown Breaker must have separate cooldowns:

crown_might: cooldown: 30

soul_reaper: cooldown: 25

soul_reaper_attack: cooldown: 5

Prevent ability spam.

---

==========================================

VOID REAPER

==========================================

Base:

Sword

Theme:

Void / Soul / Darkness

PASSIVE — VOID MARK

Every successful attack has a configurable chance to apply Void Mark.

Example:

chance: 0.25 duration: 8 damage_multiplier: 1.25

Marked players receive:

  • purple particles
  • dark aura
  • increased Void Reaper damage

PRIMARY — VOID SLASH

Right click.

Launch a visible dark sword slash.

Use:

  • ray tracing
  • particles
  • hit detection
  • configurable damage

SECONDARY — RIFT STEP

Sneak + right click.

Teleport the player forward.

Create a void rift at the starting point.

Damage enemies near the rift.

ULTIMATE — BLACK HOLE

Sneak + left click.

Create a black-hole area.

Features:

  • pull players
  • pull mobs
  • periodic damage
  • dark particles
  • spiral
  • expanding rings
  • final explosion

Configurable:

  • radius
  • duration
  • pull strength
  • damage
  • cooldown

---

==========================================

INFERNO EDGE

==========================================

Base:

Sword

Theme:

Fire

PASSIVE — BURNING EDGE

Chance to ignite enemy.

PRIMARY — FLAME SLASH

Create a large curved flame slash.

SECONDARY — INFERNO DASH

Dash forward.

Damage enemies in path.

Create fire/smoke trail.

ULTIMATE — INFERNO CATACLYSM

Create a huge fire explosion.

Sequence:

  • charge
  • fire ring
  • lava particles
  • smoke
  • explosion
  • shockwave

Do not permanently burn blocks by default.

---

==========================================

THUNDER FANG

==========================================

Base:

Sword

Theme:

Lightning

PASSIVE — STATIC CHARGE

Every hit builds charge.

Display:

⚡ Static: 0/10

PRIMARY — LIGHTNING STRIKE

Target player/location receives lightning strike.

SECONDARY — THUNDER DASH

High-speed dash with lightning trail.

Damage enemies along path.

ULTIMATE — STORM JUDGMENT

Create storm zone.

Repeated lightning strikes.

Final massive strike.

Prevent lightning spam.

---

==========================================

FROSTBANE

==========================================

Base:

Sword

Theme:

Ice

PASSIVE — FROST TOUCH

Apply Frost stacks.

Example:

Frost: 1/5

At 5 stacks:

  • heavy slow
  • freeze-like effect
  • burst of ice particles

PRIMARY — ICE SLASH

Large ice sword slash.

SECONDARY — FROZEN PRISON

Create circular ice zone.

Enemies become slowed.

ULTIMATE — ABSOLUTE ZERO

Massive freezing area.

Sequence:

  • snow
  • ice rings
  • freezing aura
  • ice explosion
  • shockwave

Do not permanently destroy blocks.

---

==========================================

BLOODTHORN

==========================================

Base:

Custom Spear using resource-pack model.

Base vanilla item:

Use a suitable 1.21.11 item as technical base, preferably a Trident or other appropriate item, but hide its default identity through the resource pack/model system.

PASSIVE — BLOOD HARVEST

Hits generate Blood stacks.

Blood: 0/10

PRIMARY — BLOOD THORN

Launch 3–5 configurable thorn projectiles.

Each projectile has:

  • collision
  • damage
  • red trail
  • impact effect

SECONDARY — CRIMSON DRAIN

Drain nearby enemy health.

Heal player.

Strict healing cap.

ULTIMATE — BLOOD GARDEN

Create giant temporary blood/thorn area.

Enemies:

  • damaged
  • slowed
  • marked

Player:

  • receives controlled healing

---

==========================================

CELESTIAL RUIN

==========================================

Base:

Bow

This is the strongest ranged weapon.

PASSIVE — CELESTIAL ENERGY

Successful hits generate energy.

Celestial Energy: 0/100

PRIMARY — STAR SHOT

Special arrow projectile.

Effects:

  • cosmic trail
  • glowing particles
  • impact explosion
  • AoE damage

SECONDARY — METEOR ARROW

Charge bow.

On impact:

  • call meteor from sky
  • AoE damage
  • fire/cosmic particles
  • shockwave

ULTIMATE — CELESTIAL RUIN

Massive cinematic bow attack.

Sequence:

  1. Player charges bow.
  2. Cosmic aura appears.
  3. Arrow becomes bright.
  4. Arrow launches.
  5. Huge cosmic trail.
  6. Target area gets marked.
  7. Sky beam appears.
  8. Meteor falls.
  9. Massive impact.
  10. Expanding shockwave.
  11. Final cosmic explosion.

---

==========================================

ABYSSAL TRIDENT

==========================================

Base:

Actual Trident.

Theme:

Abyss / Ocean.

PASSIVE — ABYSSAL CURRENT

Attacks generate Abyss Energy.

PRIMARY — TIDAL SPEAR

Throw a custom water-energy projectile.

Effects:

  • water trail
  • blue particles
  • impact wave
  • knockback

SECONDARY — ABYSSAL PULL

Create a vortex.

Pull enemies toward center.

Apply slow.

ULTIMATE — OCEAN'S WRATH

Create giant abyssal storm.

Sequence:

  1. Water vortex
  2. Circular waves
  3. Trident energy
  4. Pull enemies
  5. Giant water shockwave
  6. Trident strike
  7. Massive final explosion

Do not flood the actual world.

---

CUSTOM DAMAGE SYSTEM

Create:

"DamageManager"

Every custom ability must use it.

Support:

  • normal damage
  • bonus damage
  • true damage if configured
  • AoE
  • knockback
  • projectile damage
  • fall damage interaction
  • PvP rules
  • friendly fire
  • self damage

Prevent double damage from the same hit.

Use metadata/internal tracking for ability damage.

---

TARGET SYSTEM

Create:

"TargetManager"

Support:

  • radius
  • cone
  • ray trace
  • nearest player
  • projectile collision
  • line of sight

Never damage:

  • dead entities
  • spectators
  • invalid entities

unless explicitly configured.

---

PARTICLE ENGINE

Create:

"ParticleEffectManager"

Reusable effects:

  • circle
  • sphere
  • ring
  • spiral
  • helix
  • cone
  • beam
  • slash
  • shockwave
  • vortex
  • aura
  • projectile trail
  • explosion
  • ground impact
  • charge animation

Every weapon must have unique particle colors/types.

Crown Breaker:

  • gold
  • yellow
  • soul
  • smoke

Void Reaper:

  • purple
  • black
  • soul

Inferno:

  • orange
  • red
  • flame
  • lava

Thunder:

  • blue
  • white
  • electric

Frost:

  • white
  • light blue
  • snow
  • ice

Blood:

  • dark red
  • crimson
  • thorn

Celestial:

  • white
  • gold
  • purple
  • cosmic

Abyssal:

  • dark blue
  • cyan
  • water

---

SOUND ENGINE

Create:

"SoundManager"

Every ability gets:

  • activation sound
  • charging sound
  • hit sound
  • impact sound
  • ultimate sound
  • cooldown-ready sound
  • forge sound
  • weapon-unlock sound

All configurable.

Example:

crown_breaker: soul_reaper: activation: sound: ENTITY_WITHER_SHOOT volume: 1.0 pitch: 0.7

Use only sounds available in Minecraft 1.21.11.

---

RESOURCE PACK

This is REQUIRED.

Create a second folder:

LegendaryWeaponsSMP-ResourcePack/

Create a complete resource-pack structure compatible with Minecraft 1.21.11.

Include:

pack.mcmeta

assets/ └── minecraft/ ├── textures/ │ └── item/ │ ├── crown_breaker.png │ ├── void_reaper.png │ ├── inferno_edge.png │ ├── thunder_fang.png │ ├── frostbane.png │ ├── bloodthorn.png │ ├── celestial_ruin.png │ └── abyssal_trident.png │ ├── models/ │ └── item/ │ ├── crown_breaker.json │ ├── void_reaper.json │ ├── inferno_edge.json │ ├── thunder_fang.json │ ├── frostbane.json │ ├── bloodthorn.json │ ├── celestial_ruin.json │ └── abyssal_trident.json │ └── items/ ...

Use the correct 1.21.11 item-model/resource-pack structure.

Do NOT use 1.21.12+ or 26.x-only resource-pack syntax.

---

TEXTURE REQUIREMENTS

Create actual usable texture assets where the development environment supports image generation.

Textures should be Minecraft-style pixel art.

Crown Breaker

Golden/yellow Mace.

Must visually match the supplied reference's overall:

  • yellow/gold color
  • heavy Mace shape
  • royal/legendary feeling

but must be an original asset.

Void Reaper

Black/dark-purple sword.

Inferno Edge

Red/orange flaming sword.

Thunder Fang

Electric blue sword with lightning details.

Frostbane

Ice-blue/white sword.

Bloodthorn

Crimson organic spear.

Celestial Ruin

Large powerful cosmic bow.

Abyssal Trident

Dark ocean/abyss trident.

---

ITEM MODEL

Each weapon must have:

  • inventory model
  • held model
  • third-person appearance
  • custom texture
  • correct scale
  • correct rotation
  • correct hand position

Avoid models floating incorrectly in the player's hand.

---

WEAPON GUI

Command:

/weapons

Open a polished GUI.

Display all 8 weapons.

Clicking a weapon opens:

Weapon Info

Show:

  • name
  • type
  • rarity
  • description
  • passive
  • primary
  • secondary
  • ultimate
  • cooldown
  • current level
  • owner if applicable

Use custom weapon icons.

---

FORGE SYSTEM

Command:

/legendaryforge

Create GUI.

Each weapon has a configurable recipe.

Example:

crown_breaker: materials: - NETHER_STAR:2 - NETHERITE_BLOCK:4 - GOLD_BLOCK:16

These are examples.

Make all recipes configurable.

On forge:

  1. GUI closes.
  2. Player receives cinematic effects.
  3. Particles.
  4. Sounds.
  5. Title.
  6. Subtitle.
  7. Weapon appears.
  8. Save unlock.
  9. Update statistics.

---

WEAPON OWNERSHIP

Support optional soul-binding.

Config:

weapons: soulbound: false

If enabled:

Only owner can use weapon.

If disabled:

Anyone can use it.

---

DEATH SYSTEM

Config:

death: drop-weapons: true destroy-weapons: false soulbound: false

Correctly handle:

  • death
  • respawn
  • item drops
  • item pickup
  • disconnect
  • reconnect

No duplication.

---

COOLDOWN SYSTEM

Create:

"CooldownManager"

Use:

UUID + Weapon ID + Ability ID

as cooldown key.

Display:

⚔ Soul Reaper: 4.2s

When ready:

⚔ Soul Reaper: READY

Prevent:

  • double click
  • packet spam
  • rapid activation
  • cooldown bypass

---

ACTION BAR

Use action bar for:

  • ability activation
  • cooldown
  • energy
  • stacks
  • weapon state

Example:

§6Crown Breaker §8| §eSoul Reaper §7[READY]

---

BOSS BAR

For major abilities such as:

  • Black Hole
  • Inferno Cataclysm
  • Storm Judgment
  • Absolute Zero
  • Blood Garden
  • Celestial Ruin
  • Ocean's Wrath

allow optional boss bar.

Configurable.

---

SCREEN EFFECTS

Do not force blindness or nausea unnecessarily.

Create optional cinematic effects:

  • brief darkness
  • camera feedback through particles
  • title
  • subtitle
  • sound
  • bossbar

Everything configurable.

---

COMMANDS

Implement:

/weapons /weapons list /weapons give <player> <weapon> /weapons info <weapon> /weapons reload /weapons reload effects /weapons reload sounds /weapons cooldown <player> <weapon> <ability> reset /weapons debug /legendaryforge

Tab completion required.

---

PERMISSIONS

legendaryweapons.use legendaryweapons.admin legendaryweapons.give legendaryweapons.reload legendaryweapons.forge legendaryweapons.debug

---

CONFIG FILES

Generate:

config.yml weapons.yml abilities.yml sounds.yml messages.yml recipes.yml

Do NOT put everything into one massive config.

---

CONFIG EXAMPLE

Crown Breaker:

crown_breaker:

crown_might: enabled: true damage_multiplier: 1.50 duration_seconds: 10 cooldown_seconds: 30

soul_reaper: enabled: true duration_seconds: 8 flight_speed: 0.8 cooldown_seconds: 25 fall_damage_protec

Kodari AI
KodariSep 13 at 12:30 pm 3
LegendaryWeaponsSMP
A comprehensive Paper plugin for Minecraft 1.21.11 that adds 8 legendary weapons with unique abilities, custom damage systems, particle effects, and sound engines. Features include a full weapon GUI, forge system, cooldown management, configurable abilities, and a custom resource pack. Each weapon has passive, primary, secondary, and ultimate abilities with visual effects, plus a special Crown Breaker mace with soul reaper flight mechanics and totem-breaking attacks.
Kodari can make mistakes. Review important code before using.
Files
LegendaryWeaponsSMP-ResourcePack
src
pom.xml
Code
37 2,342
src/main/java/me/legendaryweapons/smp/LegendaryWeaponsPlugin.java
package me.legendaryweapons.smp;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public final class LegendaryWeaponsPlugin extends JavaPlugin implements CommandExecutor, TabCompleter {
    private FileConfiguration abilities;
    private FileConfiguration sounds;
    private FileConfiguration messages;
    private FileConfiguration recipes;
    private WeaponItemFactory itemFactory;
    private CooldownManager cooldownManager;
    private TargetManager targetManager;
    private DamageManager damageManager;
    private ParticleEffectManager particles;
    private SoundManager soundManager;
    private AbilityManager abilityManager;
    private ForgeManager forgeManager;
    private WeaponListener weaponListener;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResource("abilities.yml", false);
        saveResource("sounds.yml", false);
        saveResource("messages.yml", false);
        saveResource("recipes.yml", false);
        reloadFiles();

        itemFactory = new WeaponItemFactory(this);
        cooldownManager = new CooldownManager();
        targetManager = new TargetManager();
        damageManager = new DamageManager(this);
        particles = new ParticleEffectManager();
        soundManager = new SoundManager(this);
        abilityManager = new AbilityManager(this);
        forgeManager = new ForgeManager(this);
        weaponListener = new WeaponListener(this);

        Bukkit.getPluginManager().registerEvents(weaponListener, this);
        Bukkit.getPluginManager().registerEvents(forgeManager, this);

        getCommand("weapons").setExecutor(this);
        getCommand("weapons").setTabCompleter(this);
        getCommand("legendaryforge").setExecutor(this);
        getCommand("legendaryforge").setTabCompleter(this);
    }

    @Override
    public void onDisable() {
        if (abilityManager != null) {
            abilityManager.cleanupAll();
        }
    }

    public void reloadFiles() {
        reloadConfig();
        abilities = load("abilities.yml");
        sounds = load("sounds.yml");
        messages = load("messages.yml");
        recipes = load("recipes.yml");
    }

    private FileConfiguration load(String name) {
        File file = new File(getDataFolder(), name);
        return YamlConfiguration.loadConfiguration(file);
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("legendaryforge")) {
            if (!(sender instanceof Player player)) {
                sender.sendMessage(message("player-only"));
                return true;
            }
            if (!player.hasPermission("legendaryweapons.forge")) {
                player.sendMessage(message("no-permission"));
                return true;
            }
            forgeManager.open(player);
            return true;
        }

        if (!(sender instanceof Player player)) {
            sender.sendMessage(message("player-only"));
            return true;
        }

        if (args.length == 0 || args[0].equalsIgnoreCase("list")) {
            openWeaponMenu(player);
            return true;
        }

        if (args[0].equalsIgnoreCase("info") && args.length >= 2) {
            WeaponType weapon = WeaponType.byId(args[1]);
            if (weapon == null) {
                player.sendMessage(message("unknown-weapon"));
                return true;
            }
            openWeaponInfo(player, weapon);
            return true;
        }

        if (args[0].equalsIgnoreCase("give") && args.length >= 3) {
            if (!player.hasPermission("legendaryweapons.give")) {
                player.sendMessage(message("no-permission"));
                return true;
            }
            Player target = Bukkit.getPlayerExact(args[1]);
            WeaponType weapon = WeaponType.byId(args[2]);
            if (target == null || weapon == null) {
                player.sendMessage(message("unknown-weapon"));
                return true;
            }
            target.getInventory().addItem(itemFactory.create(weapon, getConfig().getBoolean("settings.soulbound") ? target.getUniqueId() : null));
            player.sendMessage(message("weapon-given").replace("%weapon%", weapon.displayName()).replace("%player%", target.getName()));
            return true;
        }

        if (args[0].equalsIgnoreCase("reload")) {
            if (!player.hasPermission("legendaryweapons.reload")) {
                player.sendMessage(message("no-permission"));
                return true;
            }
            reloadFiles();
            player.sendMessage(message("reloaded"));
            return true;
        }

        if (args[0].equalsIgnoreCase("cooldown") && args.length >= 5 && args[4].equalsIgnoreCase("reset")) {
            if (!player.hasPermission("legendaryweapons.admin")) {
                player.sendMessage(message("no-permission"));
                return true;
            }
            Player target = Bukkit.getPlayerExact(args[1]);
            WeaponType weapon = WeaponType.byId(args[2]);
            if (target != null && weapon != null) {
                cooldownManager.reset(target.getUniqueId(), weapon, args[3]);
            }
            return true;
        }

        if (args[0].equalsIgnoreCase("debug")) {
            if (player.hasPermission("legendaryweapons.debug")) {
                player.sendMessage(ChatColor.GRAY + "Registered weapons: " + WeaponType.ids());
            }
            return true;
        }

        openWeaponMenu(player);
        return true;
    }

    public void openWeaponMenu(Player player) {
        player.openInventory(WeaponMenu.create(this));
    }

    public void openWeaponInfo(Player player, WeaponType weapon) {
        player.openInventory(WeaponMenu.info(this, weapon));
    }

    public String message(String key) {
        return ChatColor.translateAlternateColorCodes('&',
                messages.getString(key, key).replace("%prefix%", messages.getString("prefix", "")));
    }

    @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
        if (command.getName().equalsIgnoreCase("legendaryforge")) {
            return List.of();
        }
        if (args.length == 1) {
            return filter(List.of("list", "info", "give", "reload", "cooldown", "debug"), args[0]);
        }
        if (args.length == 2 && args[0].equalsIgnoreCase("info")) {
            return filter(Arrays.stream(WeaponType.values()).map(WeaponType::id).toList(), args[1]);
        }
        if (args.length == 3 && args[0].equalsIgnoreCase("give")) {
            return filter(Arrays.stream(WeaponType.values()).map(WeaponType::id).toList(), args[2]);
        }
        return List.of();
    }

    private List<String> filter(List<String> values, String prefix) {
        List<String> result = new ArrayList<>();
        for (String value : values) {