1modulo_yuji

MAKE A GOD SPEAR

Kodari AI
KodariJun 28 at 12:17 am 1

I’ll build a legendary spear weapon plugin with lightning abilities.

GodSpear
A legendary weapon plugin that adds a craftable God Spear with three powerful abilities: Lightning Strike (call lightning on targets), Thunder Burst (AoE knockback explosion), and Spear Thrust (bonus damage+knockback on melee). Fully configurable cooldowns, damage, crafting recipe, and permissions. Features particle effects, custom sounds, and PersistentDataContainer-based item identification.
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
9 537
src/main/java/com/godspear/GodSpear.java
package com.godspear;

import com.cryptomorin.xseries.XMaterial;
import com.godspear.command.SpearCommand;
import com.godspear.listener.SpearListener;
import com.godspear.manager.CooldownManager;
import com.godspear.manager.SpearManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public final class GodSpear extends JavaPlugin {

    private CooldownManager cooldownManager;
    private SpearManager spearManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        cooldownManager = new CooldownManager();
        spearManager = new SpearManager(this, cooldownManager);

        Bukkit.getPluginManager().registerEvents(new SpearListener(this, spearManager), this);

        SpearCommand command = new SpearCommand(this, spearManager);
        getCommand("godspear").setExecutor(command);
        getCommand("godspear").setTabCompleter(command);

        registerRecipe();
        getLogger().info("GodSpear enabled — the gods have spoken.");
    }

    @Override
    public void onDisable() {
        getLogger().info("GodSpear disabled.");
    }

    private void registerRecipe() {
        NamespacedKey key = new NamespacedKey(this, "god_spear");
        ShapedRecipe recipe = new ShapedRecipe(key, spearManager.createSpear());
        recipe.shape("  N", " S ", "S  ");
        recipe.setIngredient('N', XMaterial.matchXMaterial("NETHERITE_INGOT")
                .map(XMaterial::parseMaterial).orElse(Material.DIAMOND));
        recipe.setIngredient('S', Material.STICK);
        Bukkit.addRecipe(recipe);
    }
}