technobladeneverdiesflyhigh
📎 1 file 1,484 chars
📄
pasted-code-1782634710911.txt
txt 21 lines
▶
Act as an expert Minecraft Spigot/Paper plugin developer. Write the complete Java code for a Spigot plugin (compatible with Minecraft 1.21+) that creates a custom "God Axe" item. 

The plugin should include a command `/godaxe` that gives the player this weapon.

Here are the exact specifications for the God Axe:
1. Item Type: Netherite Axe
2. Custom Name: "§4§lGod Axe" (with dark red and bold styling)
3. Enchantments to apply via Meta (Bypass vanilla caps using addUnsafeEnchantment or addEnchant with the ignoreLevelRestriction flag set to true):
   - Sharpness X (10) - Pure, massive damage
   - Efficiency X (10) - Instantly breaks blocks/shields
   - Fire Aspect II (2) - Sets targets on fire
   - Looting V (5) - Maximum mob drops
   - Make the item completely indestructible using ItemMeta#setUnbreakable(true)

4. Custom Ability (Withering Strike):
   - Create an EntityDamageByEntityEvent listener.
   - Check if the damager is a Player and if they are holding this specific God Axe (validate via custom item name or PersistentDataContainer).
   - When they hit a LivingEntity (player or mob), apply the Wither potion effect (PotionEffectType.WITHER) to the victim.
   - Set the Wither effect to Level 2 (Amplifier 1) for a duration of 5 seconds (100 ticks) so their hearts turn black and drain rapidly.

Provide the full code for the main class (JavaPlugin) and the Listener class. Keep the code clean, well-commented, and optimized for paper servers.
Kodari AI
KodariJun 28 at 8:19 am 1
GodAxe
A Spigot/Paper 1.21+ plugin that gives players a custom God Axe via /godaxe command. Features a netherite axe with Sharpness X, Efficiency X, Fire Aspect II, Looting V, and unbreakability. Includes a Withering Strike ability that applies Wither II for 5 seconds on hit. Uses PersistentDataContainer for reliable item identification.

Creating the plugin files now.

technobladeneverdiesflyhigh

make the sharpness level 7 and remove the enchant fire aspect

Kodari AI
KodariJun 28 at 8:24 am 1

Sharpness is now 7, Fire Aspect removed. Ready for cleaning?

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

import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

public class GodAxePlugin extends JavaPlugin implements CommandExecutor {

    private NamespacedKey godAxeKey;

    @Override
    public void onEnable() {
        this.godAxeKey = new NamespacedKey(this, "god-axe");

        getCommand("godaxe").setExecutor(this);
        getServer().getPluginManager().registerEvents(new GodAxeListener(this), this);
    }

    public NamespacedKey getGodAxeKey() {
        return godAxeKey;
    }

    public ItemStack createGodAxe() {
        ItemStack axe = new ItemStack(Material.NETHERITE_AXE);
        ItemMeta meta = axe.getItemMeta();

        meta.setDisplayName("§4§lGod Axe");

        meta.addEnchant(Enchantment.SHARPNESS, 7, true);
        meta.addEnchant(Enchantment.EFFICIENCY, 10, true);
                meta.addEnchant(Enchantment.LOOTING, 5, true);

        meta.setUnbreakable(true);

        meta.getPersistentDataContainer().set(godAxeKey, PersistentDataType.BOOLEAN, true);

        axe.setItemMeta(meta);
        return axe;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player)) {
            sender.sendMessage("Only players can use this command.");
            return true;
        }

        Player player = (Player) sender;
        player.getInventory().addItem(createGodAxe());
        player.sendMessage("§aYou have received the §4§lGod Axe§a!");
        return true;
    }
}