g2682.k

Create a Minecraft plugin for version 1.21+.

I want a custom Netherite Sword with a lightning ability.

Item:

Type: Netherite Sword Name: &b&lFella Sword Custom lore supported Ability:

When a player right-clicks with the sword:

A lightning strike hits the target player Target = the player you are looking at (or nearest player within 10 blocks) Effects:

The lightning must damage only the player It must NOT break blocks It must NOT create fire It must NOT damage the environment Only deal damage to the target player Cooldown: 45 seconds per player If used during cooldown, show message: “Ability is on cooldown: X seconds remaining” Commands:

Give item command: /fellaswordlight give All commands should use the base: /fella Customization (config.yml):

Damage amount Range (default: 10 blocks) Cooldown (default: 45 seconds) Item name & lore Messages Features:

Multiplayer support Smooth ability (no lag) No bugs or glitches Optimized performance

Kodari AI
KodariMay 6 at 4:27 pm 6,329 (v2)

I’ll create a custom Netherite Sword plugin with a lightning strike ability.

FellaSword
A custom Netherite Sword plugin featuring a powerful lightning strike ability. Right-click to summon lightning on targeted players within configurable range. Includes per-player cooldowns, customizable damage, and full configuration support for item properties, ability settings, and messages. Lightning strikes are environment-safe (no block damage or fire). Optimized for multiplayer servers with smooth performance.

Project created! Here’s what I’ve built:

Core Features:

  • Custom Netherite Sword with persistent data container identification

  • Right-click lightning ability with smart targeting (ray trace + nearest player fallback)

  • Per-player cooldown system with remaining time display

  • Lightning strikes damage only the target player (no environmental damage)

  • Full configuration support for all aspects

Files Created:

  • FellaSword.java - Main plugin class

  • FellaCommand.java - Command handler for /fella give and /fella reload

  • SwordListener.java - Right-click detection and targeting logic

  • CooldownManager.java - UUID-based cooldown tracking

  • ItemBuilder.java - Custom sword creation with PDC validation

  • config.yml - All configurable options (damage, range, cooldown, item properties, messages)

Commands:

  • /fella give <player> - Give the Fella Sword

  • /fella reload - Reload configuration

Optimizations:

  • Ray tracing for precise targeting

  • Directional awareness (dot product filtering)

  • Efficient cooldown management with auto-cleanup

  • No unnecessary entity loops

The plugin is ready to compile and deploy on 1.21+ servers!

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
9 410
src/main/java/com/fellasword/plugin/FellaSword.java
package com.fellasword.plugin;

import com.fellasword.plugin.commands.FellaCommand;
import com.fellasword.plugin.listeners.SwordListener;
import com.fellasword.plugin.managers.CooldownManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public final class FellaSword extends JavaPlugin {

    private CooldownManager cooldownManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.cooldownManager = new CooldownManager();
        
        getCommand("fella").setExecutor(new FellaCommand(this));
        getServer().getPluginManager().registerEvents(new SwordListener(this), this);
        
        getLogger().info("FellaSword has been enabled!");
    }

    @Override
    public void onDisable() {
        getLogger().info("FellaSword has been disabled!");
    }

    public void reloadPluginConfig() {
        reloadConfig();
    }
}