Prevent empty stack exception in PlayerListener
An additional condition is added to prevent an exception from being thrown when attempting to peek an empty stack in the PlayerListener.java file. This should resolve issues where checking if the playerDeathsStack is before the cut off time caused an empty stack exception error.
This commit is contained in:
parent
de24ca4437
commit
99f66c3b4b
|
|
@ -103,7 +103,7 @@ public class PlayerListener implements Listener {
|
|||
Stack<Instant> playerDeathsStack = sendPlayerDeaths.computeIfAbsent(uuid, key -> new Stack<>());
|
||||
Instant cutOff = Instant.now().minus(Config.DEATH_MESSAGES_LIMIT_PERIOD_MINUTES, ChronoUnit.MINUTES);
|
||||
|
||||
while (playerDeathsStack.peek().isBefore(cutOff)) {
|
||||
while (!playerDeathsStack.isEmpty() && playerDeathsStack.peek().isBefore(cutOff)) {
|
||||
playerDeathsStack.pop();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user