12345bartek

Generate a golden sword plugin that fires three lightning bolts at the enemy after hitting a mob or player. The config should include a space for the item type, the item name, and the item's lore. The plugin should have a reload command and a space for the sword's cooldown in configuration.

Kodari AI
KodariFeb 24 at 10:44 pm 6,737 (v2)

I’ll create a lightning sword plugin with configurable item settings and cooldown.

LightningSword
A powerful weapon plugin that strikes enemies with three lightning bolts upon hit. Features a fully configurable custom sword with adjustable item type, name, and lore. Includes cooldown system to prevent spam and reload command for configuration changes. Players can obtain the sword through commands and use it in combat against both mobs and players.

Plugin created successfully!

Features:

  • Golden sword (configurable) that strikes enemies with 3 lightning bolts

  • Fully configurable item type, name, and lore in config.yml

  • Cooldown system with configurable duration

  • /lightningsword give [player] - Get the lightning sword

  • /lightningsword reload - Reload configuration

  • Works on both mobs and players

  • Cross-version compatible using XSeries

The sword is identified by its display name, and cooldown messages show the remaining time. All colors and messages are customizable in the config!

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
7 319
src/main/java/com/lightningsword/LightningSword.java
package com.lightningsword;

import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class LightningSword extends JavaPlugin {
    
    private SwordManager swordManager;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.swordManager = new SwordManager(this);
        
        getCommand("lightningsword").setExecutor(new LightningSwordCommand(this));
        getServer().getPluginManager().registerEvents(new SwordListener(this), this);
        
        getLogger().info("LightningSword has been enabled!");
    }
    
    @Override
    public void onDisable() {
        getLogger().info("LightningSword has been disabled!");
    }
    
    public void reloadConfiguration() {
        reloadConfig();
        swordManager.reload();
    }
}