Tristan Butterworth

can you create a paper plugin when you do /ranked spear you get a netherite spear that when spear someone they lose 3 hearts for 20 seconds and gain it back after

Kodari AI
KodariOct 18 at 1:29 am 1
RankedSpear
A Paper plugin adding a ranked spear weapon. When a player executes /ranked spear, they receive a custom netherite spear item. The spear applies a 3-heart damage effect on hit for 20 seconds, after which the hearts are restored. Includes cooldown management, item metadata, and effect tracking per player.
  • Add /ranked spear and a marked netherite spear item.

  • Add a player-hit effect that deals 3 extra hearts and heals that amount after 20 seconds.

  • Create the Paper plugin metadata and build configuration.

Created the Paper plugin. /ranked spear gives a marked netherite spear; hitting a player with it deals 3 extra hearts of damage, then heals up to 3 hearts after 20 seconds. The server must support the netherite spear item.

Tristan Butterworth

can you also add a cooldown 1 minute so when your ability is done there is a cooldown in the middle above health and hunger bar

Kodari AI
KodariOct 18 at 1:31 am 1
  • Start a 60-second per-player cooldown when the spear ability triggers; hits during it do normal damage only.

  • Show the remaining seconds in the action bar and show when the spear is ready again.

Added a 60-second cooldown after the spear ability activates. While it’s active, spear hits deal normal damage; the countdown and “Spear ready!” appear in the action bar.

Tristan Butterworth

can you make it to use ability is shift right click also when your ability is ready to use its green and once used it goes red and when on cooldown its grey

Kodari AI
KodariOct 18 at 1:32 am 1
  • Shift-right-click the marked spear to arm the ability; your next hit applies its effect.

  • Show ready in green, armed in red, and the 60-second cooldown in grey above the hotbar.

Shift-right-clicking the marked spear arms the ability for your next player hit. The action bar shows ready in green, armed in red, and the 60-second cooldown in grey. The cooldown starts when the ability hits a player.

Tristan Butterworth

can you make it take 3 hearts away like actual hearts not absorbsion

Kodari AI
KodariOct 18 at 1:38 am 1

The ability now removes 6 points directly from the player’s health after the normal hit, bypassing absorption hearts, then restores the removed health after 20 seconds.

Tristan Butterworth

no i mean like it doesnt damage them 3 hearts it actually takes the hearts

Kodari AI
KodariOct 18 at 1:57 am 1

The ability now temporarily reduces the victim’s maximum health by 6 points (3 hearts), so those hearts are removed from their health bar instead of just dealing damage. Their maximum health returns after 20 seconds.

Tristan Butterworth

can you change the spear name to Ranked Spear

Kodari AI
KodariOct 18 at 1:59 am 1

Changed the item name to Ranked Spear and updated the /ranked spear confirmation message to match.

Tristan Butterworth

can you also add a sword ability so when you shift right click they get stunned for 3.5 seconds with a 1 minute cooldown

Kodari AI
KodariOct 18 at 2:03 am 1
  1. Add /ranked sword to give a uniquely marked Ranked Sword.

  2. Shift-right-click a player with it to stun them for 3.5 seconds, with a 60-second per-user cooldown.

  3. Prevent stunned players from moving or attacking, and show the sword’s ready/cooldown state in the action bar.

Added /ranked sword to get the Ranked Sword. Shift-right-click a player while holding it to stun them for 3.5 seconds; the ability then has a 60-second cooldown. Stunned players can’t move or attack, and the action bar shows green when ready and grey during cooldown.

Tristan Butterworth

can you also add one for bow so the bows ability is wherever you shoot or whoever they shoot summons thunder on them doing 4 hearts

Kodari AI
KodariOct 18 at 2:07 am 1
  • Add /ranked bow with a uniquely marked Ranked Bow.

  • Shift-right-click to arm it; the next arrow calls a visual lightning strike at its impact and removes 4 hearts from a player hit.

  • Add a 60-second cooldown and matching green/red/grey action-bar status.

Added /ranked bow for a marked Ranked Bow. Shift-right-click to arm it, then your next shot calls lightning where the arrow lands; if it hits a player, it removes 4 hearts. The ability has a 60-second cooldown with ready, armed, and cooldown status in the action bar.

Tristan Butterworth

can you make the sword radius 20 blocks

Kodari AI
KodariOct 18 at 2:10 am 1
  • Expand the sword stun to affect all players within a 20-block radius of the user.

  • Keep the existing 3.5-second stun and 60-second cooldown.

The sword ability now stuns all other players within 20 blocks of you for 3.5 seconds. It still has a 60-second cooldown.

Tristan Butterworth

can you also make the bow summon more than 1 thunder maybe like 5

Kodari AI
KodariOct 18 at 2:11 am 1

The bow now creates 5 visual lightning strikes in a small area around the arrow’s impact. Player hits still take 4 hearts of damage once.

Tristan Butterworth

can you also add a /trust system so the abilities dont work on people who are trusted and can you also add /untrust also for the sword you dont have to right click someone you just right click anyware

Kodari AI
KodariOct 18 at 2:20 am 1
  1. Add /trust and /untrust, and ensure abilities ignore trusted targets.

  2. Make the sword ability activate by right-clicking anywhere with the sword.

  • Added /trust <player> and /untrust <player>. The trusted list is saved and persists across restarts; the target must be online when changing it.

  • Spear, sword, and bow abilities now exclude players you trust. Sword’s normal weapon hit still works; it’s the ability effect that’s blocked.

  • The sword ability now activates by sneak-right-clicking anywhere with the Ranked Sword, with its existing 20-block range, 3.5-second stun, and 60-second cooldown.

Tristan Butterworth

can you add descriptions to the weapons like what it does when you hover over them

Kodari AI
KodariOct 18 at 11:57 am 1
  • Add hover lore for each weapon describing activation, effect, and cooldown.

  • Keep the existing item names, markers, and ability behavior unchanged.

Added hover descriptions to the Ranked Spear, Ranked Sword, and Ranked Bow, including their activation, effects, and cooldowns.

Tristan Butterworth

can you make it so you can heal while stunned

Kodari AI
KodariOct 18 at 12:39 pm 1
  • Allow normal item interactions while stunned so food and healing items can be used.

  • Keep the early return so weapon abilities still cannot activate during a stun.

Players can now eat and use healing items while stunned. Weapon abilities remain inactive during the stun.

Tristan Butterworth

can you increase all cooldowns to 1minute and 30 seconds

Kodari AI
KodariOct 18 at 12:46 pm 1
  • Change spear, sword, and bow cooldown durations to 90 seconds.

  • Update each weapon’s hover description to match.

Spear, sword, and bow cooldowns are now 1 minute 30 seconds. Their hover descriptions have been updated to show the new duration.

Tristan Butterworth

can you change so when you shoot the bow at wherever a dome of sculk spawns in a 15x15 and the spear when you hit them summons thunder doing 4 hearts

Kodari AI
KodariNov 4 at 3:55 pm 1
  1. Change bow impact to create a 15×15 sculk dome at the arrow’s landing spot.

  2. Change the spear hit ability to summon lightning and deal 4 hearts.

The Ranked Bow now creates a 15×15 sculk dome where its empowered arrow lands. The Ranked Spear’s empowered hit now shows a lightning strike and deals 4 hearts of extra damage; its hover description is updated too. Both keep the 90-second cooldown.

Tristan Butterworth

also the sculk dissapears after 20 seconds and the cooldown on bow is 2 mins

Kodari AI
KodariNov 4 at 3:56 pm 1
  1. Make the bow’s sculk dome disappear after 20 seconds.

  2. Set the bow cooldown to 2 minutes and update its hover description.

The sculk dome now restores the blocks it replaced after 20 seconds. The bow cooldown is now 2 minutes, and its hover description reflects the change.

Tristan Butterworth

can you make it so the sword stuns whoever you hit and you have 15 seconds to hit them and if you dont it goes on cooldown and make them stunned for 4 seconds

Kodari AI
KodariNov 4 at 3:57 pm 1
  • Change sword right-click to arm a 15-second hit window instead of stunning nearby players immediately.

  • On a successful hit, stun that untrusted player for 4 seconds and start the existing 90-second cooldown; if the window expires, start the cooldown then.

  • Update the sword’s hover description and armed status.

Changed the sword ability: sneak-right-click to arm it, then hit an untrusted player within 15 seconds to stun them for 4 seconds. The 90-second cooldown starts after a successful stun—or when the 15-second window expires.

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

import com.cryptomorin.xseries.XMaterial;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
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.PlayerMoveEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.NamespacedKey;

import java.util.HashMap;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

public final class RankedSpearPlugin extends JavaPlugin implements Listener, CommandExecutor {
    private NamespacedKey spearKey;
    private NamespacedKey swordKey;
    private NamespacedKey bowKey;
    private final Map<UUID, Long> cooldowns = new HashMap<>();
    private final Map<UUID, Long> swordCooldowns = new HashMap<>();
    private final Map<UUID, Long> swordActivationDeadlines = new HashMap<>();
    private final Map<UUID, Long> bowCooldowns = new HashMap<>();
    private final Map<UUID, Long> stunnedPlayers = new HashMap<>();
    private final Set<UUID> armedPlayers = new HashSet<>();
    private final Set<UUID> armedSwordPlayers = new HashSet<>();
    private final Set<UUID> armedBowPlayers = new HashSet<>();
    private final Map<UUID, UUID> empoweredArrows = new HashMap<>();

    @Override
    public void onEnable() {
        spearKey = new NamespacedKey(this, "ranked_spear");
        swordKey = new NamespacedKey(this, "ranked_sword");
        bowKey = new NamespacedKey(this, "ranked_bow");
        getServer().getPluginManager().registerEvents(this, this);
        getCommand("ranked").setExecutor(this);
        getCommand("trust").setExecutor(this);
        getCommand("untrust").setExecutor(this);
        getServer().getScheduler().runTaskTimer(this, () -> {
            long now = System.currentTimeMillis();
            for (Player player : getServer().getOnlinePlayers()) {
                ItemStack heldItem = player.getInventory().getItemInMainHand();
                if (isRankedSpear(heldItem)) {
                    player.sendActionBar(getAbilityStatus(player, now));
                } else if (isRankedSword(heldItem)) {
                    player.sendActionBar(getSwordStatus(player, now));
                } else if (isRankedBow(heldItem)) {
                    player.sendActionBar(getBowStatus(player, now));
                }
            }
        }, 0L, 20L);
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("trust") || command.getName().equalsIgnoreCase("untrust")) {
            return handleTrustCommand(sender, command, args);
        }

        if (args.length != 1 || (!args[0].equalsIgnoreCase("spear")
                && !args[0].equalsIgnoreCase("sword") && !args[0].equalsIgnoreCase("bow"))) {
            sender.sendMessage("§cUsage: /ranked <spear|sword|bow>");
            return true;
        }

        if (!(sender instanceof Player player)) {
            sender.sendMessage("Only players can use this command.");
            return true;
        }

        String materialName = args[0].equalsIgnoreCase("spear") ? "NETHERITE_SPEAR"
                : args[0].equalsIgnoreCase("sword") ? "NETHERITE_SWORD" : "BOW";
        String itemName = args[0].equalsIgnoreCase("spear") ? "Ranked Spear"
                : args[0].equalsIgnoreCase("sword") ? "Ranked Sword" : "Ranked Bow";
        NamespacedKey itemKey = args[0].equalsIgnoreCase("spear") ? spearKey
                : args[0].equalsIgnoreCase("sword") ? swordKey : bowKey;
        Material spearMaterial = XMaterial.matchXMaterial(materialName)
                .map(XMaterial::parseMaterial)
                .orElseGet(() -> Material.matchMaterial(materialName));
        if (spearMaterial == null) {
            player.sendMessage("This server version does not support the " + materialName.toLowerCase().replace('_', ' ') + " item.");
            return true;
        }

        ItemStack spear = new ItemStack(spearMaterial);
        ItemMeta meta = spear.getItemMeta();
        meta.setDisplayName("§6" + itemName);
        if (args[0].equalsIgnoreCase("spear")) {
            meta.setLore(List.of(
                    "§7Sneak + right-click to arm.",
                    "§7Your next hit calls lightning and deals 4 hearts.",
                    "§7Cooldown: 90 seconds."
            ));
        } else if (args[0].equalsIgnoreCase("sword")) {
            meta.setLore(List.of(
                    "§7Sneak + right-click to arm for 15 seconds.",
                    "§7Your next hit stuns an untrusted player for 4 seconds.",
                    "§7Cooldown: 90 seconds."
            ));
        } else {
            meta.setLore(List.of(
                    "§7Sneak + right-click to arm.",
                    "§7Your next shot creates a 15x15 sculk dome at impact.",
                    "§7Cooldown: 2 minutes."
            ));
        }
        meta.getPersistentDataContainer().set(itemKey, PersistentDataType.BYTE, (byte) 1);
        spear.setItemMeta(meta);

        player.getInventory().addItem(spear).values().forEach(item ->
                player.getWorld().dropItemNaturally(player.getLocation(), item));
        player.sendMessage("§aYou received the " + itemName + ".");
        return true;
    }

    private boolean handleTrustCommand(CommandSender sender, Command command, String[] args) {
        if (!(sender instanceof Player player)) {
            sender.sendMessage("Only players can use this command.");
            return true;
        }
        if (args.length != 1) {
            player.sendMessage("§cUsage: /" + command.getName() + " <player>");
            return true;
        }

        Player target = getServer().getPlayerExact(args[0]);
        if (target == null) {
            player.sendMessage("§cThat player must be online.");
            return true;
        }
        if (target.equals(player)) {
            player.sendMessage("§cYou cannot trust or untrust yourself.");
            return true;
        }

        String path = "trusted." + player.getUniqueId();
        List<String> trustedPlayers = new ArrayList<>(getConfig().getStringList(path));
        String targetId = target.getUniqueId().toString();
        if (command.getName().equalsIgnoreCase("trust")) {
            if (trustedPlayers.contains(targetId)) {
                player.sendMessage("§eThat player is already trusted.");
                return true;
            }
            trustedPlayers.add(targetId);
            player.sendMessage("§aYou now trust " + target.getName() + ". Your abilities will not affect them.");
        } else {
            if (!trustedPlayers.remove(targetId)) {
                player.sendMessage("§eThat player is not trusted.");
                return true;
            }
            player.sendMessage("§aYou no longer trust " + target.getName() + ".");
        }
        getConfig().set(path, trustedPlayers);
        saveConfig();
        return true;
    }

    @EventHandler
    public void onSpearInteract(PlayerInteractEvent event) {
        if (isStunned(event.getPlayer())) {
            return;
        }

        if (event.getHand() != EquipmentSlot.HAND
                || (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
                || !event.getPlayer().isSneaking()) {
            return;
        }

        Player player = event.getPlayer();
        if (isRankedBow(event.getItem())) {
            event.setCancelled(true);
            if (bowCooldowns.getOrDefault(player.getUniqueId(), 0L) <= System.currentTimeMillis()) {
                armedBowPlayers.add(player.getUniqueId());
                player.sendActionBar(Component.text("Bow ability armed", NamedTextColor.RED));
            }
            return;
        }
        if (isRankedSword(event.getItem())) {
            event.setCancelled(true);
            long now = System.currentTimeMillis();