Class CooldownManager

java.lang.Object
dev.crafty.core.player.CooldownManager

public class CooldownManager extends Object
  • Constructor Details

    • CooldownManager

      public CooldownManager()
  • Method Details

    • createCooldown

      public static void createCooldown(String key, long cooldownMs)
      Creates a cooldown with the specified key and duration.
      Parameters:
      key - The cooldown key identifier
      cooldownMs - The cooldown duration in milliseconds
    • tryPerformAction

      public static boolean tryPerformAction(String key, UUID playerId, Runnable action)
      Attempts to perform an action if the player is not on cooldown. If the cooldown has expired or doesn't exist, the action is executed and the cooldown is updated.
      Parameters:
      key - The cooldown key to check
      playerId - The UUID of the player
      action - The action to perform if not on cooldown
      Returns:
      true if the action was performed, false if blocked by cooldown