mirror of
https://github.com/songoda/EpicVouchers.git
synced 2024-11-14 22:25:29 +01:00
Optimized CoolDownManager.java
This commit is contained in:
parent
c1b57454b9
commit
bfa3c17292
@ -28,11 +28,14 @@ public class CoolDownManager {
|
||||
}
|
||||
|
||||
public boolean isOnCoolDown(UUID uuid) {
|
||||
if(!entries.containsKey(uuid)) {
|
||||
|
||||
Long time = entries.get(uuid);
|
||||
|
||||
if (time == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(entries.get(uuid) >= System.currentTimeMillis()) {
|
||||
if (time >= System.currentTimeMillis()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -41,10 +44,12 @@ public class CoolDownManager {
|
||||
}
|
||||
|
||||
public long getTime(UUID uuid) {
|
||||
if(!entries.containsKey(uuid)) {
|
||||
final Long time = entries.get(uuid);
|
||||
|
||||
if (time == null) {
|
||||
return 0L;
|
||||
}
|
||||
|
||||
return (entries.get(uuid) - System.currentTimeMillis()) / 1000;
|
||||
return (time - System.currentTimeMillis()) / 1000;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user