Ameen Vanderschyff

A magical fantasy weapon expansion featuring five powerful, custom-crafted weapons. Each weapon has its own appearance, special ability, particle effects, sounds and crafting recipe. All five are designed to be difficult to obtain in survival mode, making them valuable rewards for players who collect rare materials and explore dangerous dimensions.

  1. Bloodreaper – The Life-Stealing Sword

Type: Legendary sword Theme: Blood magic and life stealing Special ability: Blood Burst

Bloodreaper is a legendary crimson sword infused with ancient blood magic. Its blade glows dark red, with pulsing energy running through its edges. Whenever the player strikes an enemy, Bloodreaper steals a portion of the damage dealt and converts it into health for the wielder.

Its passive ability, Life Steal, restores a small amount of health with every successful hit. The stronger the attack, the more health can be recovered, up to a balanced maximum.

Its special ability, Blood Burst, releases accumulated blood energy, restoring additional health to the player. Activating it creates a red explosion of particles around the wielder.

Crafting recipe:

  • 1 Netherite Sword
  • 2 Diamonds
  • 1 Nether Star Shard

2. Stormbreaker – The Thunder Hammer Type: Legendary hammer Theme: Lightning and thunder Special ability: Thunder Crash

Stormbreaker is a massive magical hammer containing the power of a thunderstorm. Its metallic head glows with bright blue energy, while small lightning particles travel across its surface.

Its passive ability gives successful attacks a chance to produce a lightning effect, dealing additional damage and knocking enemies backwards.

Its special ability, Thunder Crash, allows the player to slam the hammer down, creating a powerful lightning-themed shockwave around them. Nearby enemies receive damage and are knocked away.

Crafting recipe:

  • 1 Netherite Ingot
  • 3 Lightning Rods
  • 2 Diamonds

3. Voidfang – The Shadow Daggers Type: Legendary dual daggers Theme: Darkness and teleportation Special ability: Shadow Step

Voidfang consists of two enchanted daggers infused with mysterious End energy. Their blades glow purple, leaving dark particles whenever the player attacks.

These daggers are designed for fast attacks, allowing players to strike enemies quickly.

Their passive ability creates a small chance of briefly weakening an enemy when hit.

Their special ability, Shadow Step, teleports the player a short distance in the direction they are facing. Upon teleporting, the player becomes briefly invisible and leaves behind a cloud of purple smoke.

Crafting recipe:

  • 2 Netherite Ingots
  • 2 Ender Pearls
  • 1 Phantom Membrane

4. Frostbite – The Ice Spear Type: Legendary spear Theme: Ice and freezing Special ability: Frozen Ground

Frostbite is a magical spear created from ancient ice crystals. Its blade is made of glowing blue ice, surrounded by frozen particles.

Its passive ability slows enemies whenever they are struck, making it particularly useful against fast-moving opponents.

Its special ability, Frozen Ground, creates a temporary icy area around the player. Enemies entering the area become slowed, making them easier to fight.

Crafting recipe:

  • 2 Diamonds
  • 2 Packed Ice
  • 1 Heart of the Sea

5. Tempest – The Storm Bow Type: Legendary ranged weapon Theme: Storm magic and lightning Special ability: Chain Lightning

Tempest is a legendary bow containing the power of the storm. Its limbs glow electric blue, with lightning particles surrounding the string whenever it is drawn.

Its passive ability allows fully charged arrows to deal additional magical damage. Arrows also produce small electrical particle effects when they hit their target.

Its special ability, Chain Lightning, fires a magical charged arrow that creates a lightning effect on impact. The lightning can jump between nearby enemies, dealing reduced damage with each additional hit.

Crafting recipe:

  • 1 Bow
  • 3 Diamonds
  • 2 Phantom Membranes
  • 1 Nether Star Shard
Kodari AI
KodariNov 4 at 9:55 pm 6
LegendaryWeapons
A magical fantasy weapon expansion adding five legendary custom-crafted weapons: Bloodreaper (life-stealing sword), Stormbreaker (thunder hammer), Voidfang (shadow daggers), Frostbite (ice spear), and Tempest (storm bow). Each weapon features unique particle effects, sounds, crafting recipes, passive abilities, and special active abilities. Bloodreaper steals health on hit and unleashes Blood Burst; Stormbreaker triggers lightning strikes and Thunder Crash shockwaves; Voidfang weakens enemies and grants Shadow Step teleportation; Frostbite slows enemies and creates Frozen Ground zones; Tempest fires charged arrows with Chain Lightning that jumps between targets. All weapons require rare materials like Nether Stars, Ender Pearls, and Hearts of the Sea, making them difficult survival-mode rewards.
  1. Create the five weapons, their recipes, and a craftable Nether Star Shard.

  2. Add combat effects and right-click abilities, with cooldowns.

  3. Use vanilla item appearances; custom weapon art requires enabling Kodari Studio in project settings under Generation, or at https://kodari.ai/settings?tab=features.

Created the five craftable weapons and their abilities. One Nether Star crafts into nine shards.

Right-click to activate abilities; for Tempest, sneak-right-click to arm its next arrow. Voidfang crafts as two vanilla sword items, and Frostbite uses a trident appearance.

Custom weapon models and textures require enabling Kodari Studio as described above.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
4 345
src/main/java/com/kodari/fantasyweapons/FantasyWeapons.java
package com.kodari.fantasyweapons;

import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XAttribute;
import com.cryptomorin.xseries.XPotion;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.particles.XParticle;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
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.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapelessRecipe;
import org.bukkit.inventory.RecipeChoice;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.util.Vector;

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;

public final class FantasyWeapons extends org.bukkit.plugin.java.JavaPlugin implements Listener {
    private NamespacedKey itemKey;
    private NamespacedKey arrowKey;
    private NamespacedKey tempestArrowKey;
    private boolean abilityDamage;
    private final Map<UUID, Map<String, Long>> cooldowns = new HashMap<>();
    private final Map<UUID, Double> blood = new HashMap<>();
    private final Set<UUID> charged = new HashSet<>();

    @Override
    public void onEnable() {
        itemKey = new NamespacedKey(this, "weapon");
        arrowKey = new NamespacedKey(this, "charged_arrow");
        tempestArrowKey = new NamespacedKey(this, "tempest_arrow");
        registerRecipes();
        Bukkit.getPluginManager().registerEvents(this, this);
    }

    private ItemStack material(String name) {
        return XMaterial.matchXMaterial(name).map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("Missing material: " + name));
    }

    private ItemStack item(String id, String material, String name, String... lore) {
        ItemStack item = material(material);
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
        meta.setLore(Arrays.stream(lore).map(line -> ChatColor.translateAlternateColorCodes('&', line)).toList());
        meta.getPersistentDataContainer().set(itemKey, PersistentDataType.STRING, id);
        item.setItemMeta(meta);
        return item;
    }

    private String id(ItemStack item) {
        if (item == null || !item.hasItemMeta()) return "";
        return item.getItemMeta().getPersistentDataContainer().getOrDefault(itemKey, PersistentDataType.STRING, "");
    }

    private void recipe(String id, ItemStack result, String... ingredients) {
        ShapelessRecipe recipe = new ShapelessRecipe(new NamespacedKey(this, id), result);
        for (String ingredient : ingredients) {
            if (ingredient.equals("SHARD")) {
                recipe.addIngredient(new RecipeChoice.ExactChoice(shard()));
            } else {
                recipe.addIngredient(material(ingredient).getType());
            }
        }
        Bukkit.addRecipe(recipe);
    }

    private ItemStack shard() {
        return item("shard", "AMETHYST_SHARD", "&dNether Star Shard", "&7A fragment of a Nether Star.");
    }

    private void registerRecipes() {
        ItemStack shards = shard();
        shards.setAmount(9);
        recipe("nether_star_shards", shards, "NETHER_STAR");
        recipe("bloodreaper", item("bloodreaper", "NETHERITE_SWORD", "&4&lBloodreaper", "&7Life Steal: heal on successful hits.", "&cRight-click: Blood Burst."),
                "NETHERITE_SWORD", "DIAMOND", "DIAMOND", "SHARD");
        recipe("stormbreaker", item("stormbreaker", "NETHERITE_AXE", "&b&lStormbreaker", "&7Strikes can summon lightning.", "&bRight-click: Thunder Crash."),
                "NETHERITE_INGOT", "LIGHTNING_ROD", "LIGHTNING_ROD", "LIGHTNING_ROD", "DIAMOND", "DIAMOND");
        ItemStack daggers = item("voidfang", "NETHERITE_SWORD", "&5&lVoidfang", "&7Strikes can weaken enemies.", "&dRight-click: Shadow Step.");
        daggers.setAmount(2);
        recipe("voidfang", daggers, "NETHERITE_INGOT", "NETHERITE_INGOT", "ENDER_PEARL", "ENDER_PEARL", "PHANTOM_MEMBRANE");
        recipe("frostbite", item("frostbite", "TRIDENT", "&b&lFrostbite", "&7Strikes slow enemies.", "&bRight-click: Frozen Ground."),
                "DIAMOND", "DIAMOND", "PACKED_ICE", "PACKED_ICE", "HEART_OF_THE_SEA");
        recipe("tempest", item("tempest", "BOW", "&b&lTempest", "&7Fully charged arrows deal bonus damage.", "&eSneak + right-click: arm Chain Lightning."),
                "BOW", "DIAMOND", "DIAMOND", "DIAMOND", "PHANTOM_MEMBRANE", "PHANTOM_MEMBRANE", "SHARD");
    }

    private void particle(String name, Location location, int count, double spread) {
        XParticle.of(name).ifPresent(p -> location.getWorld().spawnParticle(p.get(), location, count, spread, spread, spread, 0.01));
    }

    private void sound(Player player, String name) {
        XSound.matchXSound(name).ifPresent(s -> s.play(player));
    }

    private void effect(LivingEntity entity, String name, int duration, int amplifier) {
        XPotion.matchXPotion(name).map(p -> p.buildPotionEffect(duration, amplifier)).ifPresent(entity::addPotionEffect);
    }

    private void heal(Player player, double amount) {
        org.bukkit.attribute.AttributeInstance max = XAttribute.of("MAX_HEALTH")
                .map(attribute -> player.getAttribute(attribute.get())).orElse(null);
        if (max != null && !player.isDead()) player.setHealth(Math.min(max.getValue(), player.getHealth() + amount));
    }

    private boolean cooldown(Player player, String ability, int seconds) {
        Map<String, Long> times = cooldowns.computeIfAbsent(player.getUniqueId(), key -> new HashMap<>());
        long now = System.currentTimeMillis();
        long remaining = times.getOrDefault(ability, 0L) - now;
        if (remaining > 0) {
            player.sendMessage(ChatColor.RED + "Ability ready in " + ((remaining + 999) / 1000) + "s.");
            return false;
        }
        times.put(ability, now + seconds * 1000L);
        return true;
    }

    private void knockAway(LivingEntity target, Location origin, double strength) {
        Vector direction = target.getLocation().toVector().subtract(origin.toVector());
        direction.setY(0);
        if (direction.lengthSquared() < 0.001) direction = new Vector(1, 0, 0);
        target.setVelocity(direction.normalize().multiply(strength).setY(0.35));
    }

    private void abilityDamage(LivingEntity target, double damage, Player player) {
        abilityDamage = true;
        try {
            target.damage(damage, player);
        } finally {
            abilityDamage = false;
        }
    }

    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    public void onHit(EntityDamageByEntityEvent event) {
        if (abilityDamage || !(event.getDamager() instanceof Player player) || !(event.getEntity() instanceof LivingEntity target) || event.getFinalDamage() <= 0) return;
        String weapon = id(player.getInventory().getItemInMainHand());
        switch (weapon) {
            case "bloodreaper" -> {
                double stolen = Math.min(3.0, event.getFinalDamage() * 0.15);
                heal(player, stolen);
                blood.merge(player.getUniqueId(), stolen, (a, b) -> Math.min(12.0, a + b));
                particle("DAMAGE_INDICATOR", target.getLocation().add(0, 1, 0), 8, 0.3);
            }
            case "stormbreaker" -> {
                if (ThreadLocalRandom.current().nextDouble() < 0.20) {
                    target.getWorld().strikeLightningEffect(target.getLocation());
                    abilityDamage(target, 3.0, player);
                    knockAway(target, player.getLocation(), 0.8);
                }
            }
            case "voidfang" -> {
                particle("PORTAL", target.getLocation().add(0, 1, 0), 15, 0.4);
                if (ThreadLocalRandom.current().nextDouble() < 0.25) effect(target, "WEAKNESS", 60, 0);
            }
            case "frostbite" -> {
                effect(target, "SLOWNESS", 60, 0);
                particle("SNOWFLAKE", target.getLocation().add(0, 1, 0), 12, 0.4);
            }
            default -> { }
        }
    }

    @EventHandler(ignoreCancelled = true)
    public void onUse(PlayerInteractEvent event) {
        if (event.getHand() != EquipmentSlot.HAND || (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)) return;
        Player player = event.getPlayer();
        String weapon = id(event.getItem());
        if (weapon.equals("tempest")) {
            if (!player.isSneaking()) return;
            event.setCancelled(true);
            if (charged.remove(player.getUniqueId())) {
                player.sendMessage(ChatColor.GRAY + "Chain Lightning disarmed.");
            } else {
                charged.add(player.getUniqueId());