0

it should look like that just an example

--- 📎 Attached 1 file(s):

File: pasted-code-1773945648795.txt

txt
Create a Minecraft Spigot/Paper plugin (Java) that implements a cooldown display system for custom weapons.

Core Requirements

The plugin must display cooldowns above the player’s hotbar (ActionBar).

Only show cooldowns for special weapons that the player currently has in their inventory.

If the player has none of the special weapons, nothing should be displayed.

Supported Weapons & Cooldowns

Each weapon must:

Be identified using PersistentDataContainer (PDC) (do NOT rely only on item names).

Have its own cooldown duration and color.

Display cooldown in ActionBar in a clean, readable format.

Weapons list:

Dash Sword

Cooldown: 25 seconds

Color: Green

Pull Sword

Cooldown: 40 seconds

Color: Purple

Frozen Crossbow

Cooldown: 40 seconds

Color: Ice Blue (light blue/cyan tone)

Cobweb Axe

Cooldown: 20 seconds

Color: Orange

Sonic Bow

Cooldown: 40 seconds

Color: Dark Red

Warden Sword

Cooldown: 40 seconds

Color: Dark Blue

TNT Sword

Cooldown: 60 seconds (1 minute)

Color: Red

When fully cooled down, display: "Ready" instead of time

Behavior Requirements

The plugin should:

Continuously update the ActionBar (e.g., every tick or every few ticks).

Dynamically detect which special items are in the player’s inventory.

Show only those items’ cooldowns.

Example:

If player has Dash Sword + TNT Sword, show only those two.

If player has no special weapons, show nothing.

Cooldown Logic

Track cooldowns per player and per weapon.

Use a HashMap or similar structure to store cooldown timestamps.

Provide a public method/API hook to start cooldowns (so other plugins can trigger them).

Format:

While cooling down: WeaponName: Xs

When ready (only TNT Sword requires explicit “Ready”): TNT Sword: Ready

Technical Requirements

Use modern Spigot/Paper API practices

Use Adventure API (Component) for ActionBar messages

Use PersistentDataContainer (NamespacedKey) for item identification

Include:

Null checks

Clean, optimized code

Proper plugin structure (main class, listener, manager classes)

Extra Notes

Do NOT hardcode item detection using only display names.

Ensure performance is good (avoid heavy loops every tick).

Make the system easily extendable for adding more weapons later.
1 image attached
Kodari AI
KodariMar 19 at 6:43 pm 12,470 (v2)

I’ll create a weapon cooldown display plugin that shows real-time cooldowns in the ActionBar, matching the style shown in your screenshot.

WeaponCooldownDisplay
Advanced weapon cooldown display system for PvP servers. Tracks and displays cooldowns for custom weapons (Dash Sword, Pull Sword, Frozen Crossbow, Cobweb Axe, Sonic Bow, Warden Sword, TNT Sword) in ActionBar with color-coded status indicators. Uses PersistentDataContainer for reliable item identification and Adventure API for modern text components. Includes public API for external cooldown triggers.

Perfect! I’ve created a complete weapon cooldown display plugin with the following features:

Key Features: ✅ ActionBar Display - Shows cooldowns above hotbar in real-time (updates every 5 ticks/0.25s) ✅ PDC Identification - Uses PersistentDataContainer with key weapon_type for reliable weapon detection ✅ 7 Weapon Types - All weapons with correct cooldowns and colors ✅ Smart Display - Only shows weapons currently in player’s inventory ✅ Color-Coded - Each weapon has its distinctive color using MiniMessage ✅ Public API - cooldownManager.startCooldown(player, weaponType) for external triggers ✅ Performance Optimized - Efficient checks, cleans up expired cooldowns automatically

How to Use the API:

Java
WeaponCooldownPlugin plugin = (WeaponCooldownPlugin) Bukkit.getPluginManager().getPlugin("WeaponCooldownDisplay");
plugin.getCooldownManager().startCooldown(player, WeaponType.DASH_SWORD);

Display Format:

  • Cooling down: Dash Sword: 15s (in green)

  • Ready (except TNT): READY (in weapon color)

  • TNT Sword ready: TNT Sword: Ready (in red)

  • Multiple weapons: separated by gray |

Matches your screenshot’s style perfectly! 🎯

0

make sure the cooldowns dont pop up in chat

Kodari AI
KodariMar 19 at 6:45 pm 7,443 (v2)

I’ll read the current implementation to see how cooldown messages are being displayed.

✓ The plugin is already configured correctly - cooldowns only display in the action bar, not in chat.

Looking at the code:

  • ActionBarTask uses player.sendActionBar() which displays above the hotbar

  • No player.sendMessage() calls anywhere in the codebase

  • No chat messages are being sent

The cooldown displays are exclusively shown in the action bar (the area above your hotbar), which is exactly what you want. They won’t clutter the chat at all.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
7 345
src/main/java/com/craitpvp/weaponcooldown/WeaponCooldownPlugin.java
package com.craitpvp.weaponcooldown;

import com.craitpvp.weaponcooldown.manager.CooldownManager;
import com.craitpvp.weaponcooldown.task.ActionBarTask;
import lombok.Getter;
import org.bukkit.NamespacedKey;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class WeaponCooldownPlugin extends JavaPlugin {
    
    private CooldownManager cooldownManager;
    private NamespacedKey weaponKey;
    private ActionBarTask actionBarTask;
    
    @Override
    public void onEnable() {
        this.weaponKey = new NamespacedKey(this, "weapon_type");
        this.cooldownManager = new CooldownManager();
        
        this.actionBarTask = new ActionBarTask(this);
        this.actionBarTask.runTaskTimer(this, 0L, 5L);
        
        getLogger().info("WeaponCooldownDisplay has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (this.actionBarTask != null) {
            this.actionBarTask.cancel();
        }
        getLogger().info("WeaponCooldownDisplay has been disabled!");
    }
}