Skip to content
This repository has been archived by the owner on Dec 2, 2018. It is now read-only.

Cooldown system #21

Open
crejk opened this issue Oct 18, 2018 · 0 comments
Open

Cooldown system #21

crejk opened this issue Oct 18, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@crejk
Copy link
Contributor

crejk commented Oct 18, 2018

Create cooldown system.
For example:

final Cooldown<?> cooldown = new Cooldown<>();
final ? key;
cooldown.isOnCooldown(key); //boolean - return true if [obj] is on cooldown
cooldown.put(key, 5); //add cooldown(put to cooldown map)(time in seconds)
cooldown.put(key, 5, TimeUnit.MINUTES);
cooldown.putIfAbsent(key, 5); //put if 'isOnCooldown' return false
cooldown.putIfAbsent(key, 5, TimeUnit.MINUTES);
cooldown.ifAbsent(key, () -> { //run runnable if 'isOnCooldown' return true
});
//more...
@crejk crejk added the enhancement New feature or request label Oct 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant