Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static HashMap<UUID, Double> cooldown;
- public static void setupCooldown() {
- cooldown = new HashMap<>();
- }
- public static void setCooldown(Player p, int seconds) {
- double delay = System.currentTimeMillis() + (seconds*1000);
- cooldown.put(p.getUniqueId(), delay);
- }
- public static int getCooldown(Player p) {
- return Math.toIntExact(Math.round((cooldown.get(p.getUniqueId()) - System.currentTimeMillis()/1000)));
- }
- public static boolean checkCooldown(Player p ) {
- if(!cooldown.containsKey(p.getUniqueId()) || cooldown.get(p.getUniqueId()) <= System.currentTimeMillis()) {
- return true;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement