fix: add additional protection to stone cooldown check
This commit is contained in:
parent
6885dcc13d
commit
518e458c5f
@ -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)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user