sage_harpy_jump

make a god spear that is crafted by every spear varient exsept a netherrite spear and make sure it dont make the hunger go down and it gives sat, fire, regen, and speed 3

Kodari AI
KodariAug 31 at 12:34 pm 1
GodSpearForge
GodSpearForge adds a legendary God Spear craftable from all spear variants except netherite. The crafted spear grants permanent saturation, fire resistance, regeneration, and speed III effects while held, and prevents hunger depletion entirely. Includes custom crafting recipe, effect management, and item metadata handling.

I’ll create a Paper plugin targeting Minecraft 1.21.11 with six God Spear recipes—wood, stone, copper, iron, gold, and diamond—while excluding netherite, plus continuous saturation, fire resistance, regeneration, and Speed III while held.

Created the GodSpear Paper plugin with:

  • God Spear recipes using wooden, stone, copper, iron, golden, and diamond spears.

  • No netherite spear recipe.

  • Nether Star and Diamond Block required for each recipe.

  • Unbreakable Trident-based God Spear.

  • While held:

    • Saturation

    • Full hunger protection

    • Fire Resistance

    • Regeneration

    • Speed III

  • Minecraft 1.21.11 Paper setup with Gradle and XSeries.

sage_harpy_jump

show me the way to craft it

Kodari AI
KodariAug 31 at 12:39 pm 1

Craft the God Spear in a crafting table using this pattern:

Plain Text
[ Empty ] [ Nether Star ] [ Empty ]
[ Empty ] [ Spear        ] [ Empty ]
[ Empty ] [ Diamond Block] [ Empty ]

The middle spear can be any of these variants:

  • Wooden Spear

  • Stone Spear

  • Copper Spear

  • Iron Spear

  • Golden Spear

  • Diamond Spear

Netherite Spear is not included.

The recipe produces the God Spear, which grants Saturation, Fire Resistance, Regeneration, and Speed III while held, and keeps hunger full.

sage_harpy_jump

thats not what i wanted i want all the spears in the recipe

Kodari AI
KodariAug 31 at 12:40 pm 1
  1. Replace the six alternative recipes with one 3×3 recipe requiring every non-netherite spear.

  2. Keep the Nether Star and Diamond Block as the remaining ingredients, with one empty slot.

Updated it to require all six non-netherite spears in one recipe:

Plain Text
[ Wooden ] [ Stone ]  [ Copper ]
[ Iron   ] [ Golden ] [ Diamond ]
[ Nether Star ] [ Diamond Block ] [ Empty ]

The required spears are:

  • Wooden Spear

  • Stone Spear

  • Copper Spear

  • Iron Spear

  • Golden Spear

  • Diamond Spear

A Netherite Spear is not required or accepted.

sage_harpy_jump

remove the netherstar

Kodari AI
KodariAug 31 at 12:41 pm 1

Removed the Nether Star from the recipe. It now uses:

Plain Text
[ Wooden ] [ Stone ]  [ Copper ]
[ Iron   ] [ Golden ] [ Diamond ]
[ Empty  ] [ Diamond Block ] [ Empty ]
sage_harpy_jump

make the god spear A FUCKING SPEAR

Kodari AI
KodariAug 31 at 12:50 pm 1

Changed the God Spear’s base item from a trident to an actual diamond spear (DIAMOND_SPEAR). It will now have real spear behavior while keeping the custom name, powers, and recipe.

sage_harpy_jump

also make sure its maxed

Kodari AI
KodariAug 31 at 12:54 pm 1

The God Spear is now maxed with:

  • Sharpness V

  • Smite V

  • Bane of Arthropods V

  • Fire Aspect II

  • Looting III

  • Knockback II

  • Lunge III

  • Unbreaking III

  • Mending I

It remains unbreakable and keeps its hunger protection and potion effects.

sage_harpy_jump

also add abilitys

Kodari AI
KodariAug 31 at 12:56 pm 1

What abilities do you want on the God Spear, and how should they activate?

Examples:

  • Right-click: Lightning strike

  • Sneak + right-click: Throw a shockwave

  • Hit an enemy: Fire explosion or knockback

  • Kill an enemy: Heal the player

  • Ability key: Dash forward

  • Passive: Strength, resistance, or water breathing

Also specify whether abilities should have cooldowns.

sage_harpy_jump

lightning strike 5 secs shockwave 10 secs and tell me the ability key

Kodari AI
KodariAug 31 at 1:01 pm 1
  1. Add lightning strike on right-click with a 5-second cooldown.

  2. Add shockwave on sneak + right-click with a 10-second cooldown.

  3. Preserve the existing recipe, maxed enchantments, hunger protection, and passive effects, then document the controls.

Added both abilities:

  • Right-click: Lightning Strike

    • Cooldown: 5 seconds

    • Strikes the block you’re looking at, up to 30 blocks away.

  • Sneak + Right-click: Shockwave

    • Cooldown: 10 seconds

    • Damages and knocks back nearby living entities within 5 blocks.

The ability controls are also shown in the God Spear’s lore.

sage_harpy_jump

make it say when it was crafted

Kodari AI
KodariAug 31 at 7:06 pm 1

[Generation stopped]

sage_harpy_jump

make it say when it was crafted and make it only craftable once

Kodari AI
KodariAug 31 at 7:08 pm 1
  1. Add the craft timestamp to the created God Spear.

  2. Persist a one-time craft lock so the recipe cannot be crafted again after the first successful craft.

Implemented:

  • Adds the exact crafting date and time to the God Spear lore: Crafted: yyyy-MM-dd HH:mm:ss

  • The God Spear can now only be crafted once.

  • The one-time craft status persists after server restarts.

  • The recipe is removed immediately after the first successful craft.

  • Further attempts display: “The God Spear has already been crafted.”

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

import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XEnchantment;
import com.cryptomorin.xseries.XPotion;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.CraftItemEvent;
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.Vector;

import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public final class GodSpearPlugin extends JavaPlugin implements Listener {

    private NamespacedKey godSpearKey;
    private final Map<UUID, Long> lightningCooldowns = new HashMap<>();
    private final Map<UUID, Long> shockwaveCooldowns = new HashMap<>();

    @Override
    public void onEnable() {
        godSpearKey = new NamespacedKey(this, "god_spear");
        saveDefaultConfig();
        registerRecipes();
        Bukkit.getPluginManager().registerEvents(this, this);
        Bukkit.getScheduler().runTaskTimer(this, this::applyGodSpearEffects, 0L, 20L);
    }

    private void registerRecipes() {
        String[] spearTiers = {
                "WOODEN_SPEAR",
                "STONE_SPEAR",
                "COPPER_SPEAR",
                "IRON_SPEAR",
                "GOLDEN_SPEAR",
                "DIAMOND_SPEAR"
        };
        Material[] spearMaterials = new Material[spearTiers.length];
        for (int i = 0; i < spearTiers.length; i++) {
            spearMaterials[i] = Material.matchMaterial(spearTiers[i]);
            if (spearMaterials[i] == null) {
                getLogger().warning("Could not register the God Spear recipe for missing material: " + spearTiers[i]);
                return;
            }
        }

        for (String tier : spearTiers) {
            Bukkit.removeRecipe(new NamespacedKey(this, "god_spear_" + tier.toLowerCase()));
        }

        NamespacedKey recipeKey = new NamespacedKey(this, "god_spear");
        Bukkit.removeRecipe(recipeKey);
        if (getConfig().getBoolean("god-spear-crafted", false)) {
            return;
        }

        ShapedRecipe recipe = new ShapedRecipe(recipeKey, createGodSpear());
        recipe.shape("ABC", "DEF", " G ");
        recipe.setIngredient('A', spearMaterials[0]);
        recipe.setIngredient('B', spearMaterials[1]);
        recipe.setIngredient('C', spearMaterials[2]);
        recipe.setIngredient('D', spearMaterials[3]);
        recipe.setIngredient('E', spearMaterials[4]);
        recipe.setIngredient('F', spearMaterials[5]);
        recipe.setIngredient('G', XMaterial.matchXMaterial("DIAMOND_BLOCK")
                .map(XMaterial::parseMaterial)
                .orElse(Material.AIR));
        Bukkit.addRecipe(recipe);
    }

    private ItemStack createGodSpear() {
        Material diamondSpear = Material.matchMaterial("DIAMOND_SPEAR");
        if (diamondSpear == null) {
            throw new IllegalStateException("DIAMOND_SPEAR is unavailable");
        }
        ItemStack spear = new ItemStack(diamondSpear);
        ItemMeta meta = spear.getItemMeta();
        if (meta == null) {
            throw new IllegalStateException("Could not create God Spear metadata");
        }

        meta.setDisplayName("&b&lGod Spear");
        meta.setLore(List.of(
                "&7Forged from the power of every spear tier.",
                "&eWhile held:",
                "&f Saturation",
                "&f Fire Resistance",
                "&f Regeneration",
                "&f Speed III",
                "&bRight-click: Lightning Strike &7(5s)",
                "&bSneak + Right-click: Shockwave &7(10s)"
        ));
        meta.setUnbreakable(true);
        addMaxEnchantments(meta);
        meta.getPersistentDataContainer().set(godSpearKey, PersistentDataType.BYTE, (byte) 1);
        spear.setItemMeta(meta);
        return spear;
    }

    private void addMaxEnchantments(ItemMeta meta) {
        addEnchantment(meta, "SHARPNESS", 5);
        addEnchantment(meta, "SMITE", 5);
        addEnchantment(meta, "BANE_OF_ARTHROPODS", 5);
        addEnchantment(meta, "FIRE_ASPECT", 2);
        addEnchantment(meta, "LOOTING", 3);
        addEnchantment(meta, "KNOCKBACK", 2);
        addEnchantment(meta, "LUNGE", 3);
        addEnchantment(meta, "UNBREAKING", 3);
        addEnchantment(meta, "MENDING", 1);
    }

    private void addEnchantment(ItemMeta meta, String name, int level) {
        XEnchantment.matchXEnchantment(name)
                .ifPresent(enchantment -> meta.addEnchant(enchantment.getEnchant(), level, true));
    }

    private void applyGodSpearEffects() {
        for (Player player : Bukkit.getOnlinePlayers()) {
            if (!isGodSpear(player.getInventory().getItemInMainHand())
                    && !isGodSpear(player.getInventory().getItemInOffHand())) {
                continue;
            }

            player.setFoodLevel(20);
            player.setSaturation(20.0f);
            player.setExhaustion(0.0f);

            XPotion.matchXPotion("SATURATION")
                    .map(potion -> potion.buildPotionEffect(40, 0))
                    .ifPresent(effect -> player.addPotionEffect(effect, true));
            XPotion.matchXPotion("FIRE_RESISTANCE")
                    .map(potion -> potion.buildPotionEffect(60, 0))
                    .ifPresent(effect -> player.addPotionEffect(effect, true));
            XPotion.matchXPotion("REGENERATION")
                    .map(potion -> potion.buildPotionEffect(60, 0))
                    .ifPresent(effect -> player.addPotionEffect(effect, true));
            XPotion.matchXPotion("SPEED")
                    .map(potion -> potion.buildPotionEffect(60, 2))
                    .ifPresent(effect -> player.addPotionEffect(effect, true));
        }
    }

    private boolean isGodSpear(ItemStack item) {
        if (item == null || item.getType().isAir() || !item.hasItemMeta()) {
            return false;
        }
        return item.getItemMeta().getPersistentDataContainer().has(godSpearKey, PersistentDataType.BYTE);
    }

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

        event.setUseItemInHand(Event.Result.DENY);
        event.setUseInteractedBlock(Event.Result.DENY);

        Player player = event.getPlayer();
        if (player.isSneaking()) {
            if (isOnCooldown(shockwaveCooldowns, player.getUniqueId(), 10_000L)) {
                player.sendMessage("&cShockwave is on cooldown.");
                return;
            }
            useShockwave(player);
            return;
        }

        if (isOnCooldown(lightningCooldowns, player.getUniqueId(), 5_000L)) {
            player.sendMessage("&cLightning Strike is on cooldown.");
            return;
        }
        useLightningStrike(player);
    }

    private boolean isOnCooldown(Map<UUID, Long> cooldowns, UUID playerId, long cooldownMillis) {
        long now = System.currentTimeMillis();