Viraj peta

Make a GOD.MACE NAME KING BREAKER ENCHANT ALL 10 LEVEL AND CRAFTING RECIPE DRAGON EGG AND 2 MACE AND SPECIAL POWARS SHIFT+RIGHT CLICK TO GET A DEMON ATTACK

Kodari AI
KodariOct 2 at 12:49 pm 1
KingBreakerMace
A Minecraft plugin adding a legendary King Breaker mace with all enchantments at level 10. Crafted using a dragon egg and two maces, this weapon grants special demonic powers. When the player shift-right-clicks, it summons a devastating demon attack that damages nearby enemies with fire and explosion effects. The plugin includes custom crafting recipes, enchantment application, and a cooldown system for the special ability.
  • Create the Paper plugin skeleton and register the crafting recipe.

  • Craft the marked KING BREAKER mace with every supported enchantment at level 10.

  • Add its sneak + right-click demon attack with a cooldown.

Created the KING BREAKER Paper plugin. Its recipe uses one Dragon Egg and two Maces; the result is named KING BREAKER and receives the available enchantments at level 10. Sneak + right-click summons a demon to attack the creature you’re aiming at, with a 10-second cooldown.

Viraj peta

How work

Kodari AI
KodariOct 2 at 12:53 pm 1
  1. On a Minecraft 1.21+ server, install the plugin JAR in the server’s plugins folder and restart.

  2. Craft it in a 3×3 crafting table: put Mace in the top-left and top-right slots, and a Dragon Egg in the center slot. The other slots stay empty.

  3. Hold the KING BREAKER, aim at a creature, then sneak + right-click. It summons a glowing Vex named Demon to attack your target. The demon disappears after 5 seconds, and the ability has a 10-second cooldown.

The mace is given the enchantments recognized by the plugin at level 10. If you aren’t aiming at a creature, it can target a nearby monster instead.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
3 192
src/main/java/com/kodari/kingbreaker/KingBreakerPlugin.java
package com.kodari.kingbreaker;

import com.cryptomorin.xseries.XEnchantment;
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.particles.XParticle;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.entity.Vex;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.RayTraceResult;

public final class KingBreakerPlugin extends JavaPlugin implements Listener {
    private static final long DEMON_COOLDOWN_MILLIS = 10_000L;
    private static final List<String> ENCHANTMENTS = List.of(
            "AQUA_AFFINITY", "BANE_OF_ARTHROPODS", "BINDING_CURSE", "BLAST_PROTECTION",
            "BREACH", "CHANNELING", "DENSITY", "DEPTH_STRIDER", "EFFICIENCY", "FEATHER_FALLING",
            "FIRE_ASPECT", "FIRE_PROTECTION", "FLAME", "FORTUNE", "FROST_WALKER", "IMPALING",
            "INFINITY", "KNOCKBACK", "LOOTING", "LOYALTY", "LUCK_OF_THE_SEA", "LURE", "MENDING",
            "MULTISHOT", "PIERCING", "POWER", "PROJECTILE_PROTECTION", "PROTECTION", "PUNCH",
            "QUICK_CHARGE", "RESPIRATION", "RIPTIDE", "SHARPNESS", "SILK_TOUCH", "SMITE",
            "SOUL_SPEED", "SWEEPING_EDGE", "SWIFT_SNEAK", "THORNS", "UNBREAKING", "VANISHING_CURSE",
            "WIND_BURST"
    );

    private final Map<UUID, Long> demonCooldowns = new HashMap<>();
    private NamespacedKey itemKey;

    @Override
    public void onEnable() {
        itemKey = new NamespacedKey(this, "king_breaker");
        Bukkit.getPluginManager().registerEvents(this, this);
        registerRecipe();
    }

    private void registerRecipe() {
        Material mace = XMaterial.matchXMaterial("MACE").map(XMaterial::parseMaterial).orElse(null);
        Material dragonEgg = XMaterial.matchXMaterial("DRAGON_EGG").map(XMaterial::parseMaterial).orElse(null);
        if (mace == null || dragonEgg == null) {
            getLogger().severe("KING BREAKER requires a server version with mace and dragon egg materials.");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }

        ShapedRecipe recipe = new ShapedRecipe(new NamespacedKey(this, "king_breaker"), createKingBreaker(mace));
        recipe.shape("M M", " E ");
        recipe.setIngredient('M', mace);
        recipe.setIngredient('E', dragonEgg);
        Bukkit.addRecipe(recipe);
    }

    private ItemStack createKingBreaker(Material mace) {
        ItemStack item = new ItemStack(mace);
        ItemMeta meta = item.getItemMeta();
        if (meta == null) {
            return item;
        }

        meta.setDisplayName(ChatColor.GOLD.toString() + ChatColor.BOLD + "KING BREAKER");
        meta.setLore(List.of(
                ChatColor.DARK_RED + "Demon's Wrath",
                ChatColor.GRAY + "Sneak + right-click to summon a demon."
        ));
        for (String enchantmentName : ENCHANTMENTS) {
            XEnchantment.matchXEnchantment(enchantmentName)
                    .ifPresent(enchantment -> meta.addEnchant(enchantment.getEnchant(), 10, true));
        }
        meta.getPersistentDataContainer().set(itemKey, PersistentDataType.BYTE, (byte) 1);
        item.setItemMeta(meta);
        return item;
    }

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        if (event.getHand() != EquipmentSlot.HAND
                || (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)) {
            return;
        }

        Player player = event.getPlayer();
        if (!player.isSneaking() || !isKingBreaker(event.getItem())) {
            return;
        }

        event.setCancelled(true);
        long now = System.currentTimeMillis();
        long cooldownUntil = demonCooldowns.getOrDefault(player.getUniqueId(), 0L);
        if (now < cooldownUntil) {
            player.sendMessage(ChatColor.RED + "The demon is resting for "
                    + ((cooldownUntil - now + 999) / 1000) + "s.");
            return;
        }

        LivingEntity target = findTarget(player);
        if (target == null) {
            player.sendMessage(ChatColor.DARK_RED + "Aim at a creature to call the demon.");
            return;
        }

        Vex demon = player.getWorld().spawn(player.getLocation().add(0, 1, 0), Vex.class);
        demon.setCustomName(ChatColor.DARK_RED + "Demon");
        demon.setCustomNameVisible(true);
        demon.setGlowing(true);
        demon.setTarget(target);
        XParticle.of("SOUL_FIRE_FLAME").ifPresent(particle ->
                player.getWorld().spawnParticle(particle.get(), demon.getLocation(), 30, 0.45, 0.45, 0.45, 0.02));
        XSound.matchXSound("ENTITY_VEX_CHARGE").ifPresent(sound -> sound.play(player));
        demonCooldowns.put(player.getUniqueId(), now + DEMON_COOLDOWN_MILLIS);
        Bukkit.getScheduler().runTaskLater(this, demon::remove, 100L);
        player.sendMessage(ChatColor.DARK_RED + "The demon attacks your target!");
    }

    private boolean isKingBreaker(ItemStack item) {
        if (item == null || !item.hasItemMeta()) {
            return false;
        }
        ItemMeta meta = item.getItemMeta();
        return meta != null && meta.getPersistentDataContainer().has(itemKey, PersistentDataType.BYTE);
    }

    private LivingEntity findTarget(Player player) {
        RayTraceResult rayTrace = player.getWorld().rayTraceEntities(
                player.getEyeLocation(),
                player.getEyeLocation().getDirection(),
                24,
                0.5,
                entity -> entity instanceof LivingEntity && entity != player
        );
        if (rayTrace != null && rayTrace.getHitEntity() instanceof LivingEntity livingEntity) {
            return livingEntity;
        }

        return player.getNearbyEntities(18, 18, 18).stream()
                .filter(entity -> entity instanceof Monster)
                .map(entity -> (Monster) entity)
                .min(Comparator.comparingDouble(entity -> entity.getLocation().distanceSquared(player.getLocation())))
                .orElse(null);
    }
}