fix: add additional protection to stone cooldown check

This commit is contained in:
punchready 2021-07-07 15:00:12 +02:00
parent 6885dcc13d
commit 518e458c5f
1 changed files with 2 additions and 2 deletions

View File

@ -41,7 +41,7 @@ public class StoneCooldownManager {
* Decreases all cooldowns by one according to a round having passed.
*/
public void update() {
cooldowns.replaceAll((s, v) -> Math.max(0, cooldowns.get(s) - 1));
cooldowns.replaceAll((s, v) -> Math.max(0, cooldowns.getOrDefault(s, 0) - 1));
}
/**
@ -67,7 +67,7 @@ public class StoneCooldownManager {
* @param stone The {@link StoneType} to mark
*/
public void setCooldown(StoneType stone) {
cooldowns.put(stone, Math.max(0, maxCooldowns.get(stone)));
cooldowns.put(stone, Math.max(0, maxCooldowns.getOrDefault(stone, 0)));
}
/**