mibomboklat_1

Create a plugin that adds cooldown at spear when its used with lunge enchantment make it for 5 seconds. Make the cooldown config configurable.Make it same as shield disable

Kodari AI
KodariJun 11 at 3:32 pm 9
LungeCooldown
Adds a configurable shield-style cooldown to tridents enchanted with the Lunge enchantment. When a player uses a Lunge-enchanted trident, it disables the item for a configurable duration (default 5 seconds), identical in behavior to a shield being knocked out. Lunge detection works with any custom enchantment plugin that writes Lunge to item lore. Cooldown duration is fully configurable in config.yml.

Plan:

  • LungeCooldownPlugin.java — main class, loads config

  • LungeCooldownListener.java — listens for trident use, checks Lunge lore, applies cooldown

  • config.yml, plugin.yml, build.gradle

Lunge detection reads stripped lore (handles color codes from any custom enchant plugin). Cooldown uses player.setCooldown(Material.TRIDENT, ticks) — same API Minecraft uses for shields.

How it works:

Detail
Behavior
Trigger
Right-click with a trident that has Lunge in its lore
Detection
Strips color codes, case-insensitive match — works with any custom enchant plugin
Cooldown
player.setCooldown(Material.TRIDENT, ticks)
— identical red overlay to a disabled shield
Sound
ITEM_SHIELD_BLOCK
at 0.8 pitch — same auditory cue as shield knockback
Config
cooldown-seconds
(supports decimals, e.g.
4.5
) and
lunge-enchant-name

To change the cooldown, edit config.yml:

YAML
cooldown-seconds: 3      # 3 seconds
lunge-enchant-name: "Lunge"  # matches any lore containing this word
mibomboklat_1

not trident but spear and delete the shield sound

Kodari AI
KodariJun 11 at 3:38 pm 6

The spear in plugins like ExecutableItems/ItemsAdder isn’t a vanilla Material.TRIDENT — it’s a custom item. The cooldown now triggers by checking the item’s display name or lore for the Lunge enchantment only, with no material type restriction. Let me check the current state and fix that too:

Now also fix the setCooldown call — since it’s a custom spear (not a vanilla trident), the cooldown must be applied to whatever material the item actually is:

Also remove the now-unused Material import since we no longer reference Material.TRIDENT as a constant (it’s still needed for the method — it’s fine, leaving it). Three changes made:

  1. Removed the Sound import and the shield sound block entirely

  2. Removed the Material.TRIDENT type check — works with any custom spear item

  3. Changed setCooldown(Material.TRIDENT, ticks) → setCooldown(item.getType(), ticks) so the cooldown overlay applies to the actual spear material

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
5 141
src/main/java/com/kodari/lungecooldown/LungeCooldownPlugin.java
package com.kodari.lungecooldown;

import org.bukkit.plugin.java.JavaPlugin;

public class LungeCooldownPlugin extends JavaPlugin {

    private int cooldownTicks;
    private String lungeEnchantName;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        loadConfigValues();
        getServer().getPluginManager().registerEvents(new LungeCooldownListener(this), this);
    }

    @Override
    public void onDisable() {
    }

    public void reloadPlugin() {
        reloadConfig();
        loadConfigValues();
    }

    private void loadConfigValues() {
        double seconds = getConfig().getDouble("cooldown-seconds", 5.0);
        cooldownTicks = (int) Math.round(seconds * 20.0);
        lungeEnchantName = getConfig().getString("lunge-enchant-name", "Lunge");
    }

    public int getCooldownTicks() {
        return cooldownTicks;
    }

    public String getLungeEnchantName() {
        return lungeEnchantName;
    }
}