Jessica Pedro

Make me a mace cooldown plugin that can be configured and server operators dont have the cooldown on their maces

Kodari AI
KodariAug 30 at 6:31 am 1
MaceCooldownManager
Configurable mace cooldown plugin for Spigot/Paper servers. Applies a configurable cooldown between mace attacks for regular players, while exempting server operators from the cooldown entirely. Features configurable cooldown duration in seconds, configurable cooldown message with placeholder support, and per-player cooldown tracking. Includes a reload command to apply configuration changes without restarting the server. Uses a cooldown map to track player usage timestamps and prevents mace use until the cooldown expires. Operators bypass all cooldown checks automatically. Lightweight and performance-friendly with minimal event listener overhead.

I’ll create:

  1. A Paper 1.21+ Gradle plugin project.

  2. Configurable mace cooldown settings and blocked-use message.

  3. Operator bypass logic for both interaction and damage enforcement.

  4. A /macecooldown reload command for operators.

Created the MaceCooldown plugin with:

  • Configurable mace cooldown duration in config.yml

  • Operator bypass by default

  • Cooldown enforcement on mace attacks and interactions

  • Configurable cooldown message with {seconds} placeholder

  • /macecooldown reload command for operators

  • Paper 1.21.4 Gradle project structure

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
7 226
src/main/java/com/kodari/macecooldown/MaceCooldownPlugin.java
package com.kodari.macecooldown;

import org.bukkit.ChatColor;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public final class MaceCooldownPlugin extends JavaPlugin {

    private double cooldownSeconds;
    private boolean operatorBypass;
    private String blockedMessage;

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

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

        PluginCommand command = getCommand("macecooldown");
        if (command != null) {
            MaceCooldownCommand executor = new MaceCooldownCommand(this);
            command.setExecutor(executor);
            command.setTabCompleter(executor);
        }
    }

    public void loadSettings() {
        cooldownSeconds = Math.max(0.0, getConfig().getDouble("cooldown-seconds", 5.0));
        operatorBypass = getConfig().getBoolean("operator-bypass", true);
        blockedMessage = getConfig().getString("blocked-message", "&cYour mace is on cooldown for &e{seconds}s&c.");
    }

    public boolean bypassesCooldown(Player player) {
        return operatorBypass && player.isOp();
    }

    public int cooldownTicks() {
        return (int) Math.min(Integer.MAX_VALUE, Math.ceil(cooldownSeconds * 20.0));
    }

    public String blockedMessage(double remainingSeconds) {
        String seconds = String.format(java.util.Locale.ROOT, "%.1f", remainingSeconds);
        return ChatColor.translateAlternateColorCodes('&', blockedMessage.replace("{seconds}", seconds));
    }

    public double cooldownSeconds() {
        return cooldownSeconds;
    }
}