D

Use this updated prompt:

Create a Minecraft Paper/Spigot plugin that adds a custom weapon called God Mace.

God Mace Material: Mace Display Name: §6§lGod Mace Use PersistentDataContainer to identify the item.

Dash Ability (Right Click) When a player right-clicks while holding the God Mace:

Dash approximately 20 blocks in the direction they are looking.

The dash should feel smooth, powerful, and fast.

Spawn a trail of particles behind the player during the dash (electric, cloud, and flame particles).

Play a powerful sound effect when activated.

Prevent fall damage caused by the dash.

Cooldown: 1 second.

Show an action bar message if the ability is on cooldown.

Lightning Ability (Hit Player) When a player hits another player using the God Mace:

Strike lightning on the victim.

Find all other players within a 20-block radius of the victim.

Strike lightning on every nearby player.

Damage all affected players.

Spawn lightning and electric particles around affected players.

Play thunder sounds.

Cooldown: 1 second.

Show an action bar message if the ability is on cooldown.

Commands /godmace give <player> Permissions godmace.give godmace.use Config.yml Dash distance: 20 Dash cooldown: 1 second Lightning radius: 20 Lightning damage: configurable Lightning cooldown: 1 second Requirements Paper 1.21+ Full source code. plugin.yml included. config.yml included.

Proper event handling and cooldown management.

Optimized for SMP use with no console errors.

Abilities should work only when holding the God Mace, not normal maces.

Kodari AI
KodariMay 30 at 2:27 pm 9
GodMace
A Minecraft Paper/Spigot plugin adding a powerful custom weapon — the God Mace. Features a Dash ability (right-click) that launches players 20 blocks forward with a particle trail and prevents fall damage, and a Lightning ability (on hit) that strikes the victim and all nearby players within a configurable radius. Abilities have cooldowns, action bar feedback, and are identified via PersistentDataContainer. Fully configurable via config.yml.

Planning class dependencies:

  1. GodMacePlugin — main class, registers events/commands, exposes managers

  2. ConfigManager — wraps config.yml values

  3. GodMaceItem — builds the God Mace ItemStack, PDC key holder

  4. CooldownManager — tracks per-player cooldowns for dash + lightning

  5. DashAbility — handles right-click dash logic

  6. LightningAbility — handles hit-player lightning logic

  7. GodMaceListener — event listener wiring both abilities

  8. GodMaceCommand — /godmace give <player> command

Here’s what was built:

Files created (8):

  • GodMacePlugin.java — main class, wires all managers and registers events/commands

  • ConfigManager.java — typed accessors for all config.yml values

  • GodMaceItem.java — builds the God Mace ItemStack with PDC tag + lore

  • CooldownManager.java — per-player dash & lightning cooldown tracking with millisecond precision

  • DashAbility.java — smooth dash via velocity + BukkitRunnable trail (ELECTRIC_SPARK, CLOUD, FLAME particles), tracks dashing players for fall damage immunity

  • LightningAbility.java — strikes victim + all nearby players within radius using strikeLightningEffect (visual only, no fire), then applies configured damage directly

  • GodMaceListener.java — handles RIGHT_CLICK, EntityDamageByEntity (hit detection), fall damage cancellation, and player quit cleanup

  • GodMaceCommand.java — /godmace give <player> with tab completion

Key design decisions:

  • Fall damage is suppressed only while the dashingPlayers set contains the player (auto-cleared after ~14 ticks), so normal fall damage is unaffected

  • Lightning uses strikeLightningEffect (no fire/block damage) + manual player.damage() for clean SMP use

  • PDC check ensures abilities only fire on the custom item, never a normal Mace

D

umm something is repetively executing that i am seeing in console so fix that and remove the surround lightning and when i hit player it will strike lightning

and keep no cooldown on dash

Kodari AI
KodariMay 30 at 2:50 pm 13

The repetitive console output is caused by EntityDamageByEntityEvent firing multiple times per hit (Paper fires it for each damage source including the mace’s wind charge mechanic), and the PlayerInteractEvent firing twice (once per hand). The listener has EquipmentSlot.HAND guard for interact but the damage event has no dedup guard — each hit can fire the event repeatedly.

Three fixes:

  1. Listener — cancel the EntityDamageByEntityEvent from being processed twice by checking event.isCancelled() isn’t the issue, but the real fix is the damage event fires for the mace’s built-in smash attack too, triggering the handler multiple times. Add an ignoreCancelled = true guard and deduplicate with a short processing set.

  2. Lightning — remove the radius/nearby player logic entirely, only strike the direct victim.

  3. Dash — remove cooldown entirely.

Now clean up the unused imports in LightningAbility and remove the dash cooldown from DashAbility:

Three changes applied:

  • Repetitive console spam fixed — added a processingHit dedup set in the listener. Paper’s mace fires EntityDamageByEntityEvent multiple times per swing (wind charge + smash attack sub-events); the set blocks any duplicate processing within the same tick and clears itself next tick via a scheduled task.

  • Surrounding lightning removed — LightningAbility.activate() now only calls strikePlayer(victim, damage) on the direct hit target. The radius scan loop is gone entirely.

  • Dash cooldown removed — DashAbility.activate() no longer sets a cooldown, and the listener no longer checks one before activating the dash.

Kodari can make mistakes. Review important code before using.
Files
src
Code
10 466
src/main/java/com/godmace/GodMacePlugin.java
package com.godmace;

import com.godmace.ability.DashAbility;
import com.godmace.ability.LightningAbility;
import com.godmace.command.GodMaceCommand;
import com.godmace.config.ConfigManager;
import com.godmace.cooldown.CooldownManager;
import com.godmace.item.GodMaceItem;
import com.godmace.listener.GodMaceListener;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

public class GodMacePlugin extends JavaPlugin {

    @Getter private ConfigManager configManager;
    @Getter private CooldownManager cooldownManager;
    @Getter private GodMaceItem godMaceItem;
    @Getter private DashAbility dashAbility;
    @Getter private LightningAbility lightningAbility;

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

        configManager = new ConfigManager(this);
        cooldownManager = new CooldownManager();
        godMaceItem = new GodMaceItem(this);
        dashAbility = new DashAbility(this);
        lightningAbility = new LightningAbility(this);

        getServer().getPluginManager().registerEvents(new GodMaceListener(this), this);

        GodMaceCommand cmd = new GodMaceCommand(this);
        getCommand("godmace").setExecutor(cmd);
        getCommand("godmace").setTabCompleter(cmd);

        getLogger().info("GodMace enabled.");
    }

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