Sajid Farooq

Create a Plugin in which the concept is of there is a wepon sword with some enchants which upgrade after 5 kills in to axe and with axe 5 kills to make it mace and then 5 kills with mace to make it cross bow and all got enchant and with every weapon we have to do 5 kills to upgrade to other same kill ratio 5 for every weapon and every weapon got some op enchants not overpowered and by pressing shift and right click it upgrades and also we can come back to sword and axe also byt shifting and right clicking and some particles while upgrading or changing weapon and some particles when other weapon is unlocked and we can dupe then by presiing shifht and q and add sopund effects on some occasion

Kodari AI
KodariSep 15 at 10:54 am 2
WeaponEvolution
WeaponEvolution is a Minecraft plugin introducing a progressive weapon upgrade system. Players start with an enchanted sword that evolves into an axe, then a mace, and finally a crossbow after every 5 kills with each weapon. All weapons feature balanced, non-overpowered enchantments. Players can cycle through unlocked weapons by shift-right-clicking, with the ability to return to previous forms. The plugin includes visual particle effects during upgrades and weapon switches, plus particle bursts when new weapons unlock. Players can duplicate their current weapon by pressing shift and Q, with accompanying sound effects for all major actions including upgrades, switches, and duplications.
  1. Create the Gradle/Paper plugin foundation and metadata.

  2. Add the weapon progression model and item manager.

  3. Add kill tracking, sneak-right-click switching, unlock effects, and the requested sneak-drop duplication behavior.

  4. Give each player a starter sword on first join.

Created WeaponProgression plugin with:

  • Sword → Axe → Mace → Crossbow progression.

  • Five kills required per weapon upgrade.

  • Enchantments assigned to each weapon.

  • Sneak + right-click switches between unlocked weapons.

  • Players can cycle back to previous weapons.

  • Kill tracking stored directly on weapon items.

  • Unlock particles, switch particles, sounds, and messages.

  • Sneak + Q duplicates the held progression weapon.

  • Starter sword automatically given on first join.

  • Paper 1.21.4 Gradle project setup and plugin metadata.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
7 370
src/main/java/com/kodari/weaponprogression/WeaponProgressionPlugin.java
package com.kodari.weaponprogression;

import java.util.Map;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

public final class WeaponProgressionPlugin extends JavaPlugin implements Listener {
    private WeaponManager weaponManager;
    private NamespacedKey starterKey;

    @Override
    public void onEnable() {
        this.weaponManager = new WeaponManager(this);
        this.starterKey = new NamespacedKey(this, "starter_weapon_received");
        getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onFirstJoin(PlayerJoinEvent event) {
        if (!getConfig().getBoolean("give-on-first-join", true)) {
            return;
        }

        Player player = event.getPlayer();
        if (player.getPersistentDataContainer().has(starterKey, PersistentDataType.BYTE)) {
            return;
        }

        ItemStack starter = weaponManager.createStarterWeapon();
        Map<Integer, ItemStack> leftovers = player.getInventory().addItem(starter);
        leftovers.values().forEach(item -> player.getWorld().dropItemNaturally(player.getLocation(), item));
        player.getPersistentDataContainer().set(starterKey, PersistentDataType.BYTE, (byte) 1);
        player.sendMessage("&bYou received a progression sword. Get 5 kills to unlock the axe!");
    }

    @EventHandler
    public void onWeaponKill(EntityDeathEvent event) {
        Player killer = event.getEntity().getKiller();
        if (killer == null) {
            return;
        }

        ItemStack held = killer.getInventory().getItemInMainHand();
        WeaponType type = weaponManager.getType(held);
        if (type == null) {
            return;
        }

        int previousKills = weaponManager.getKills(held, type);
        int updatedKills = weaponManager.addKill(held);
        killer.sendMessage("&7" + type.getDisplayName() + " &7kills: &f" + updatedKills + "&7/" + WeaponManager.KILLS_REQUIRED);
        if (previousKills < WeaponManager.KILLS_REQUIRED && updatedKills >= WeaponManager.KILLS_REQUIRED
                && type.ordinal() < WeaponType.values().length - 1) {
            killer.sendMessage("&aNew weapon unlocked! Sneak and right-click to switch.");
            weaponManager.playUnlockEffects(killer);
        }
    }

    @EventHandler
    public void onWeaponSwitch(PlayerInteractEvent event) {
        if (event.getHand() != EquipmentSlot.HAND || !event.getPlayer().isSneaking() || !event.getAction().isRightClick()) {
            return;
        }

        if (!weaponManager.isWeapon(event.getItem())) {
            return;
        }

        event.setCancelled(true);
        WeaponType switchedTo = weaponManager.cycleWeapon(event.getPlayer());
        if (switchedTo != null) {
            event.getPlayer().sendMessage("&aSwitched to " + switchedTo.getDisplayName() + "&a.");
            weaponManager.playSwitchEffects(event.getPlayer());
        } else {
            event.getPlayer().sendMessage("&eGet 5 kills with this weapon to unlock the next one.");
        }
    }

    @EventHandler
    public void onWeaponDuplicate(PlayerDropItemEvent event) {
        Player player = event.getPlayer();
        if (!player.isSneaking() || !weaponManager.isWeapon(event.getItemDrop().getItemStack())) {
            return;
        }

        ItemStack duplicate = event.getItemDrop().getItemStack().clone();
        Map<Integer, ItemStack> leftovers = player.getInventory().addItem(duplicate);
        leftovers.values().forEach(item -> player.getWorld().dropItemNaturally(player.getLocation(), item));
        player.sendMessage("&dThe weapon was duplicated.");
        weaponManager.playDuplicateEffects(player);
    }
}