itzz_deepak

CROWN BREAKER VISUAL

Do NOT require or include a server resource pack.

The Crown Breaker must work entirely through the plugin using the uploaded weapon texture/visual asset where supported by the plugin implementation.

Do not require players to download a resource pack.

The custom weapon must still:

  • Have its own visual identity.
  • Use the provided Crown Breaker weapon texture as the design reference.
  • Appear vertically when dropped.
  • Rotate and float while dropped.
  • Have the specified animations and effects.

IMPORTANT:

Do not add any resource-pack URL, SHA-1, resource-pack download system, or mandatory resource-pack requirement.

Kodari AI
KodariOct 6 at 2:08 pm 1
CrownBreakerWeapon
A Bukkit plugin that introduces a legendary custom weapon called the Crown Breaker. The plugin creates a unique weapon with its own visual identity using a custom texture applied directly through the plugin, eliminating the need for any server resource pack. The weapon appears vertically when dropped, rotates and floats while on the ground, and features specified animations and effects. Players can obtain the weapon through commands, and it includes custom combat mechanics, particle effects, and sound effects. The plugin manages the weapon's unique behavior, including its drop physics, visual presentation, and interaction with players. It provides a complete standalone weapon system without requiring players to download any additional resources.
  1. Create the Paper plugin and /crownbreaker give command.

  2. Add a vertical, rotating, floating dropped display with pickup and particle effects.

  3. Keep it resource-pack-free; without a pack, Minecraft clients cannot show a custom uploaded weapon texture, so the item uses a vanilla sword model.

Created the Paper 1.21.4 plugin with /crownbreaker give [player]. Dropped weapons appear as vertical, rotating, floating item displays with spark particles; the weapon can be picked up, and hits add a particle effect.

No resource pack is required or configured. The item uses Minecraft’s vanilla Netherite Sword model: a plugin alone cannot apply the uploaded texture to players’ clients without a resource pack.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
4 287
src/main/java/com/kodari/crownbreaker/CrownBreakerPlugin.java
package com.kodari.crownbreaker;

import com.cryptomorin.xseries.XMaterial;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
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;

import java.util.List;
import java.util.Map;

public final class CrownBreakerPlugin extends JavaPlugin {
    private NamespacedKey weaponKey;
    private CrownBreakerListener listener;

    @Override
    public void onEnable() {
        weaponKey = new NamespacedKey(this, "crown_breaker");
        listener = new CrownBreakerListener(this);
        Bukkit.getPluginManager().registerEvents(listener, this);
        getCommand("crownbreaker").setExecutor(this);
        Bukkit.getScheduler().runTaskTimer(this, listener::tickDrops, 1L, 1L);
    }

    @Override
    public void onDisable() {
        if (listener != null) {
            listener.removeAllDrops();
        }
    }

    public boolean isCrownBreaker(ItemStack item) {
        if (item == null || item.getType().isAir() || !item.hasItemMeta()) {
            return false;
        }
        ItemMeta meta = item.getItemMeta();
        return meta.getPersistentDataContainer().has(weaponKey, PersistentDataType.BYTE);
    }

    private ItemStack createWeapon() {
        ItemStack weapon = XMaterial.matchXMaterial("NETHERITE_SWORD")
                .map(XMaterial::parseItem)
                .orElse(null);
        if (weapon == null) {
            return null;
        }

        ItemMeta meta = weapon.getItemMeta();
        meta.setDisplayName(ChatColor.GOLD.toString() + ChatColor.BOLD + "Crown Breaker");
        meta.setLore(List.of(
                ChatColor.GRAY + "A relic made to shatter crowns.",
                ChatColor.DARK_GRAY + "Its power leaves a lingering spark."
        ));
        meta.getPersistentDataContainer().set(weaponKey, PersistentDataType.BYTE, (byte) 1);
        weapon.setItemMeta(meta);
        return weapon;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length < 1 || !args[0].equalsIgnoreCase("give") || args.length > 2) {
            sender.sendMessage(ChatColor.YELLOW + "Usage: /crownbreaker give [player]");
            return true;
        }

        Player target;
        if (args.length == 2) {
            target = Bukkit.getPlayerExact(args[1]);
            if (target == null) {
                sender.sendMessage(ChatColor.RED + "That player is not online.");
                return true;
            }
        } else if (sender instanceof Player player) {
            target = player;
        } else {
            sender.sendMessage(ChatColor.RED + "Specify an online player.");
            return true;
        }

        ItemStack weapon = createWeapon();
        if (weapon == null) {
            sender.sendMessage(ChatColor.RED + "Could not create the Crown Breaker item.");
            return true;
        }

        Map<Integer, ItemStack> leftovers = target.getInventory().addItem(weapon);
        leftovers.values().forEach(item -> target.getWorld().dropItemNaturally(target.getLocation(), item));
        sender.sendMessage(ChatColor.GREEN + "Gave the Crown Breaker to " + target.getName() + ".");
        if (sender != target) {
            target.sendMessage(ChatColor.GOLD + "You received the Crown Breaker.");
        }
        return true;
    }
}