Cooldown class

What is it?

Cooldown.java is a pretty easy way to make a delay before using a command/item etc. Cooldown.java provides quite a bit of flexibility. It also gives you the ability to specify what happens after the cooldown.

How to use it

Declare Cooldown variable.

private Cooldown<Player> cooldown = new Cooldown<>();
// You also can use string, UUID and etc. for T arg.

Adding cooldown

// Just add cooldown
cooldown.addNewCooldown(player, cooldownTime); 

// Rewrite cooldown if exists
cooldown.addNewCooldown(player, cooldownTime, true); 

// Execute runnable after cooldown is complete.
cooldown.addNewCooldown(player, cooldownTime, new Runnable()); 

// Rewirite cooldown if exists and execute runnable after cooldown is complete.
cooldown.addNewCooldown(player, cooldownTime, new Runnable(), true); 

Removing and checking cooldowns

cooldown.containCooldown(player); // Check for cooldown
cooldown.removeCooldown(player); // Remove cooldown

Last updated