Mckenzie Jones

make a sword that stuns people in chains after 15 hits

Kodari AI
KodariOct 4 at 5:28 pm 1
ChainStunSword
ChainStunSword is a Minecraft plugin that adds a custom sword with a unique chain-stun mechanic. When a player lands 15 successful hits on an enemy using this sword, the target becomes chained and stunned, unable to move or attack for a configurable duration. The plugin tracks hit counts per player-victim pair, displays visual chain effects and particle animations on activation, and resets the counter when the victim dies or the attacker switches items. Includes configurable stun duration, hit requirement, and permission-based sword crafting or obtaining.
  1. Create a Paper plugin with /chainsword to obtain the custom sword.

  2. Count player hits; every 15th hit stuns the target and nearby players for 2 seconds.

Created the ChainSword plugin. Use /chainsword to get the sword; every 15th hit on a player stuns the target and nearby players within 4 blocks for 2 seconds.

Mckenzie Jones

make a spear shot out a fire beam that one shots people

Kodari AI
KodariOct 4 at 5:31 pm 1
  1. Add /firespear to give players a tagged trident.

  2. Make right-click fire a visible, 30-block flame beam that one-shots the first player it hits, stopping at blocks.

  3. Keep the existing Chain Sword mechanics intact.

Added /firespear to give you a trident that fires a visible flame beam up to 30 blocks when right-clicked. It stops at blocks and one-shots the first player it hits. /chainsword remains unchanged.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
5 338
src/main/java/com/kodari/chainsword/ChainSwordPlugin.java
package com.kodari.chainsword;

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

public final class ChainSwordPlugin extends JavaPlugin implements CommandExecutor {
    private NamespacedKey swordKey;
    private NamespacedKey fireSpearKey;

    @Override
    public void onEnable() {
        swordKey = new NamespacedKey(this, "chain_sword");
        fireSpearKey = new NamespacedKey(this, "fire_spear");
        getServer().getPluginManager().registerEvents(new ChainSwordListener(this), this);
        getCommand("chainsword").setExecutor(this);
        getCommand("firespear").setExecutor(this);
    }

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

        boolean fireSpearCommand = command.getName().equalsIgnoreCase("firespear");
        ItemStack givenItem = fireSpearCommand ? createFireSpear() : createSword();
        if (givenItem == null) {
            player.sendMessage(ChatColor.RED + "Could not create the " + (fireSpearCommand ? "Fire Spear." : "Chain Sword."));
            return true;
        }

        player.getInventory().addItem(givenItem).values()
                .forEach(overflow -> player.getWorld().dropItemNaturally(player.getLocation(), overflow));
        player.sendMessage(ChatColor.AQUA + "You received the " + (fireSpearCommand ? "Fire Spear!" : "Chain Sword!"));
        return true;
    }

    private ItemStack createFireSpear() {
        ItemStack spear = XMaterial.matchXMaterial("TRIDENT")
                .map(XMaterial::parseItem)
                .orElse(null);
        if (spear == null) {
            return null;
        }

        ItemMeta meta = spear.getItemMeta();
        if (meta == null) {
            return null;
        }

        meta.setDisplayName(ChatColor.GOLD + "Fire Spear");
        meta.setLore(Arrays.asList(
                ChatColor.GRAY + "Right-click to fire a flame beam.",
                ChatColor.GRAY + "One-shots the first player hit."
        ));
        meta.getPersistentDataContainer().set(fireSpearKey, PersistentDataType.BYTE, (byte) 1);
        spear.setItemMeta(meta);
        return spear;
    }

    private ItemStack createSword() {
        ItemStack sword = XMaterial.matchXMaterial("IRON_SWORD")
                .map(XMaterial::parseItem)
                .orElse(null);
        if (sword == null) {
            return null;
        }

        ItemMeta meta = sword.getItemMeta();
        if (meta == null) {
            return null;
        }

        meta.setDisplayName(ChatColor.AQUA + "Chain Sword");
        meta.setLore(Arrays.asList(
                ChatColor.GRAY + "Every 15 player hits,",
                ChatColor.GRAY + "stuns nearby enemies for 2 seconds."
        ));
        meta.getPersistentDataContainer().set(swordKey, PersistentDataType.BYTE, (byte) 1);
        sword.setItemMeta(meta);
        return sword;
    }

    NamespacedKey getSwordKey() {
        return swordKey;
    }

    NamespacedKey getFireSpearKey() {
        return fireSpearKey;
    }
}