Fixed for random error with cooldown

This commit is contained in:
Brianna O'Keefe 2018-11-21 17:58:55 -05:00
parent 3788b72f62
commit a45552864c

View File

@ -13,7 +13,7 @@ public class Cooldowns {
private HashMap<UUID, Integer> entries = new HashMap<UUID, Integer>();
public void addCooldown(final UUID uuid, Voucher voucher) {
void addCooldown(final UUID uuid, Voucher voucher) {
try {
if (Bukkit.getPlayer(uuid).hasPermission("epicvouchers.bypass")) {
return;
@ -25,7 +25,7 @@ public class Cooldowns {
}
new BukkitRunnable() {
public void run() {
if (entries.get(uuid) <= 0) {
if (entries.get(uuid) <= 0 && entries.containsKey(uuid)) {
entries.remove(uuid);
cancel();
} else {
@ -34,12 +34,12 @@ public class Cooldowns {
}
}.runTaskTimer(EpicVouchers.getInstance(), 0, 20);
} catch (Exception error) {
System.out.println(Methods.formatText("<EFBFBD>cFailed to add cooldown to the UUID " + uuid + "."));
System.out.println(Methods.formatText("&cFailed to add cooldown to the UUID " + uuid + "."));
Debugger.runReport(error);
}
}
public HashMap<UUID, Integer> getEntries() {
HashMap<UUID, Integer> getEntries() {
return new HashMap<>(entries);
}
}