kyonog

​Create a plugin for Minecraft 1.21.11 - 26.3 featuring a custom Axe that works like a Mace, with the following enchantments and abilities: ​Enchantments: ​Density X ​Wind Burst II (Fully working) ​Sharpness X ​Unbreakable ​Item Attributes: ​Item Type: Golden Axe ​Unbreakable: Yes ​Attack Damage: 20 ​Abilities: ​Launch Ability: ​Trigger: Right-clicking while holding the axe. ​Effect: Launches the player 10 blocks into the air. ​Cooldown: 10 seconds. ​Lightning Strike Ability: ​Trigger: Aiming at a player and pressing Shift + Left-Click. ​Effect: Strikes a lightning bolt on the target player accompanied by intense ("crazy") particle effects. ​Cooldown: 20 seconds. ​Hit Effect: ​Trigger: Hitting any player. ​Effect: Spawns intense blood particle effects around the target. ​Progression / Unlocking System: ​When the axe is initially obtained, it acts as a regular/default axe with no special abilities. ​Unlock Command: /godaxe unlock <player> ​Unlocks all special abilities for the God Axe held by the specified player. ​Commands & GUI: ​Command: /godaxe open ​Opens a Minecraft-styled GUI. ​Inside the GUI, the God Axe is displayed, with a Barrier block placed to its left side. ​Clicking the God Axe adds it to the player's inventory, triggers a server-wide announcement title, and plays an intense sound effect: ​Title: GodAxe Subtitle: Was obtained by <player> ​Plugin Metadata: ​Plugin Name: GodAxe v2 ​Author: KyonOG

Kodari AI
KodariOct 22 at 12:47 pm 1
GodAxeV2
A Minecraft plugin introducing a legendary Golden Axe that functions as a Mace with powerful enchantments including Density X, Wind Burst II, Sharpness X, and Unbreakable. The axe features three distinct abilities: a right-click launch that propels the player 10 blocks into the air with a 10-second cooldown, a Shift+Left-Click lightning strike targeting players with intense particle effects and a 20-second cooldown, and blood particle effects on successful hits. The plugin includes a progression system where the axe starts as a regular weapon and requires the /godaxe unlock command to activate its special powers. A Minecraft-styled GUI accessible via /godaxe open displays the axe with a barrier block, allowing players to obtain it with a server-wide announcement title and dramatic sound effect. The plugin is designed for Minecraft 1.21.11-26.3 with full Wind Burst II functionality.
  1. Create the Paper plugin project files and GodAxe item with its requested enchantments and attributes.

  2. Add the GUI, unlock command, and cooldown-gated abilities, including custom mace-slam/Wind Burst behavior.

Created the GodAxe plugin project with the GUI and /godaxe open and /godaxe unlock <player> commands. The axe starts with its requested enchants and attributes, while its launch, lightning, hit effects, and custom mace-style slam with Wind Burst activate after unlocking.

The project targets Paper 1.21.11 and uses plugin version 2.0. I haven’t run a build verification.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
4 329
src/main/java/com/kyonog/godaxe/GodAxePlugin.java
package com.kyonog.godaxe;

import com.cryptomorin.xseries.XAttribute;
import com.cryptomorin.xseries.XEnchantment;
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.particles.XParticle;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.EquipmentSlotGroup;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;

public final class GodAxePlugin extends JavaPlugin implements Listener {
    private static final int MENU_AXE_SLOT = 13;
    private static final int MENU_BARRIER_SLOT = 12;
    private static final long LAUNCH_COOLDOWN_MS = 10_000L;
    private static final long LIGHTNING_COOLDOWN_MS = 20_000L;

    private final Map<java.util.UUID, Long> launchCooldowns = new HashMap<>();
    private final Map<java.util.UUID, Long> lightningCooldowns = new HashMap<>();
    private NamespacedKey godAxeKey;
    private NamespacedKey unlockedKey;
    private NamespacedKey attackDamageKey;

    @Override
    public void onEnable() {
        godAxeKey = new NamespacedKey(this, "godaxe");
        unlockedKey = new NamespacedKey(this, "abilities_unlocked");
        attackDamageKey = new NamespacedKey(this, "attack_damage");
        getServer().getPluginManager().registerEvents(this, this);
        getCommand("godaxe").setExecutor((sender, command, label, args) -> {
            if (args.length == 1 && args[0].equalsIgnoreCase("open")) {
                if (!(sender instanceof Player player)) {
                    sender.sendMessage("Only players can open the GodAxe menu.");
                    return true;
                }
                openMenu(player);
                return true;
            }

            if (args.length == 2 && args[0].equalsIgnoreCase("unlock")) {
                Player target = Bukkit.getPlayerExact(args[1]);
                if (target == null) {
                    sender.sendMessage(ChatColor.RED + "That player is not online.");
                    return true;
                }
                ItemStack heldItem = target.getInventory().getItemInMainHand();
                if (!isGodAxe(heldItem)) {
                    sender.sendMessage(ChatColor.RED + target.getName() + " must be holding a GodAxe.");
                    return true;
                }
                ItemMeta meta = heldItem.getItemMeta();
                meta.getPersistentDataContainer().set(unlockedKey, PersistentDataType.BYTE, (byte) 1);
                heldItem.setItemMeta(meta);
                sender.sendMessage(ChatColor.GREEN + "Unlocked all GodAxe abilities for " + target.getName() + ".");
                target.sendMessage(ChatColor.GOLD + "All abilities on your GodAxe have been unlocked!");
                return true;
            }

            sender.sendMessage(ChatColor.YELLOW + "Usage: /godaxe <open|unlock <player>>");
            return true;
        });
    }

    private void openMenu(Player player) {
        GodAxeMenu menu = new GodAxeMenu();
        ItemStack frame = createMenuItem("BLACK_STAINED_GLASS_PANE", " ", List.of());
        for (int slot = 0; slot < menu.inventory.getSize(); slot++) {
            if (slot < 9 || slot >= 18 || slot % 9 == 0 || slot % 9 == 8) {
                menu.inventory.setItem(slot, frame);
            }
        }
        menu.inventory.setItem(MENU_BARRIER_SLOT, createMenuItem(
                "BARRIER", ChatColor.RED + "Abilities Locked",
                List.of(ChatColor.GRAY + "Use /godaxe unlock <player>", ChatColor.GRAY + "while holding the axe.")));
        menu.inventory.setItem(MENU_AXE_SLOT, createGodAxe());
        player.openInventory(menu.inventory);
    }

    @EventHandler
    public void onMenuClick(InventoryClickEvent event) {
        if (!(event.getView().getTopInventory().getHolder() instanceof GodAxeMenu)) {
            return;
        }
        event.setCancelled(true);
        if (event.getRawSlot() != MENU_AXE_SLOT || !(event.getWhoClicked() instanceof Player player)) {
            return;
        }

        ItemStack axe = createGodAxe();
        Map<Integer, ItemStack> leftovers = player.getInventory().addItem(axe);
        leftovers.values().forEach(item -> player.getWorld().dropItemNaturally(player.getLocation(), item));
        for (Player viewer : Bukkit.getOnlinePlayers()) {
            viewer.sendTitle(ChatColor.GOLD + "GodAxe", ChatColor.WHITE + "Was obtained by " + player.getName(), 10, 70, 20);
            XSound.matchXSound("ENTITY_WITHER_SPAWN").ifPresent(sound -> sound.play(viewer));
        }
        player.closeInventory();
    }

    @EventHandler
    public void onInteract(PlayerInteractEvent event) {
        if (event.getHand() != EquipmentSlot.HAND) {
            return;
        }
        Player player = event.getPlayer();
        ItemStack heldItem = player.getInventory().getItemInMainHand();
        if (!isUnlockedGodAxe(heldItem)) {
            return;
        }

        if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (!cooldownReady(player, launchCooldowns, LAUNCH_COOLDOWN_MS, "Launch")) {
                return;
            }
            launchCooldowns.put(player.getUniqueId(), System.currentTimeMillis());
            Vector velocity = player.getVelocity();
            velocity.setY(1.35);
            player.setVelocity(velocity);
            XSound.matchXSound("ENTITY_ENDER_DRAGON_FLAP").ifPresent(sound -> sound.play(player));
            event.setCancelled(true);
            return;
        }

        if (player.isSneaking() && (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)) {
            Entity target = player.getTargetEntity(50);
            if (!(target instanceof Player targetPlayer) || targetPlayer.equals(player)) {
                return;
            }
            if (!cooldownReady(player, lightningCooldowns, LIGHTNING_COOLDOWN_MS, "Lightning")) {
                return;
            }
            lightningCooldowns.put(player.getUniqueId(), System.currentTimeMillis());
            targetPlayer.getWorld().strikeLightning(targetPlayer.getLocation());
            spawnLightningEffects(targetPlayer);
            XSound.matchXSound("ENTITY_LIGHTNING_BOLT_THUNDER").ifPresent(sound -> sound.play(targetPlayer));
            event.setCancelled(true);
        }
    }

    @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
    public void onPlayerHit(EntityDamageByEntityEvent event) {
        if (!(event.getDamager() instanceof Player attacker)
                || !(event.getEntity() instanceof Player target)
                || !isUnlockedGodAxe(attacker.getInventory().getItemInMainHand())) {
            return;
        }

        spawnBloodEffects(target);
        float fallDistance = attacker.getFallDistance();
        if (fallDistance < 1.5F) {
            return;
        }

        event.setDamage(event.getDamage() + 6.0 + (fallDistance * 2.5) + (fallDistance * 5.0));
        attacker.setFallDistance(0.0F);
        Vector velocity = attacker.getVelocity();
        velocity.setY(1.15);
        attacker.setVelocity(velocity);
        spawnWindBurstEffects(attacker);
        XSound.matchXSound("ENTITY_BREEZE_WIND_BURST").ifPresent(sound -> sound.play(attacker));
    }

    private boolean cooldownReady(Player player, Map<java.util.UUID, Long> cooldowns, long cooldownMs, String ability) {
        Long lastUsed = cooldowns.get(player.getUniqueId());
        if (lastUsed == null) {
            return true;
        }
        long remaining = cooldownMs - (System.currentTimeMillis() - lastUsed);
        if (remaining <= 0) {
            return true;
        }
        player.sendMessage(ChatColor.RED + ability + " is on cooldown for " + ((remaining + 999) / 1000) + "s.");
        return false;
    }

    private boolean isGodAxe(ItemStack item) {
        return item != null && item.hasItemMeta()