doctoeobard

Develop a plugin that introduces the legendary weapon Excalibur, a diamond sword that strikes lightning on entities it hits. The sword grants the wielder Strength I, Fire Resistance I, and Resistance I, while imposing Slowness I. Implement a crafting recipe that requires two diamond blocks, two iron blocks, and one stick, along with customizable permissions for usage.

Kodari AI
KodariFeb 9 at 8:50 pm 9,053 (v2)

I’ll create a legendary Excalibur weapon plugin with lightning strikes, special effects, and custom crafting.

ExcaliburPlugin
Introduces the legendary Excalibur sword that strikes lightning on entities hit and grants special effects to its wielder. Features include Strength I, Fire Resistance I, and Resistance I buffs with Slowness I debuff. Includes custom crafting recipe requiring diamond blocks, iron blocks, and a stick. Permission-based usage and admin commands for distribution.

Plan:

  • ItemManager for Excalibur creation/validation

  • EffectManager for wielder potion effects

  • RecipeManager for custom crafting

  • Listeners for combat (lightning) and inventory (effects)

  • Command for giving Excalibur

  • Configurable settings and permissions

Plugin created successfully!

The ExcaliburPlugin introduces a legendary diamond sword with:

  • Lightning strikes on entity hits (configurable damage)

  • Wielder buffs: Strength I, Fire Resistance I, Resistance I

  • Wielder debuff: Slowness I (balancing mechanic)

  • Custom crafting recipe: 2 diamond blocks, 2 iron blocks, 1 stick in a shaped pattern

  • Enchantments: Sharpness V, Unbreaking III, Mending (configurable)

  • Permissions: Separate permissions for usage (excalibur.use), crafting (excalibur.craft), and admin commands (excalibur.admin)

  • Admin command: /excalibur give <player> to distribute the sword

All effects, lightning behavior, enchantments, and messages are fully customizable in the config.yml. The sword is tracked using PersistentDataContainer for reliable identification across server restarts.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
12 503
src/main/java/com/excalibur/ExcaliburPlugin.java
package com.excalibur;

import com.excalibur.commands.ExcaliburCommand;
import com.excalibur.listeners.EntityDamageListener;
import com.excalibur.listeners.InventoryListener;
import com.excalibur.listeners.CraftListener;
import com.excalibur.managers.EffectManager;
import com.excalibur.managers.ItemManager;
import com.excalibur.managers.RecipeManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class ExcaliburPlugin extends JavaPlugin {
    
    private ItemManager itemManager;
    private EffectManager effectManager;
    private RecipeManager recipeManager;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.itemManager = new ItemManager(this);
        this.effectManager = new EffectManager(this);
        this.recipeManager = new RecipeManager(this);
        
        recipeManager.registerRecipe();
        
        getServer().getPluginManager().registerEvents(new EntityDamageListener(this), this);
        getServer().getPluginManager().registerEvents(new InventoryListener(this), this);
        getServer().getPluginManager().registerEvents(new CraftListener(this), this);
        
        getCommand("excalibur").setExecutor(new ExcaliburCommand(this));
        
        getLogger().info("ExcaliburPlugin has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (recipeManager != null) {
            recipeManager.unregisterRecipe();
        }
        getLogger().info("ExcaliburPlugin has been disabled!");
    }
    
    public String getMessage(String path) {
        return getConfig().getString("messages." + path, "").replace("&", "§");
    }
    
    public String getPrefix() {
        return getMessage("prefix");
    }
}