diff --git a/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java index 1c40363d2e5..7345d98b0e9 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java @@ -705,21 +705,17 @@ public void handlePlayerCommandPreprocess(final PlayerCommandPreprocessEvent eve // If so, no need to check for (and write) new ones. boolean cooldownFound = false; - // Iterate over a copy of getCommandCooldowns in case of concurrent modifications - for (final Entry entry : new HashMap<>(user.getCommandCooldowns()).entrySet()) { + for (final Entry entry : user.getCommandCooldowns().entrySet()) { // Remove any expired cooldowns if (entry.getValue() <= System.currentTimeMillis()) { user.clearCommandCooldown(entry.getKey()); // Don't break in case there are other command cooldowns left to clear. } else if (entry.getKey().matcher(fullCommand).matches()) { // User's current cooldown hasn't expired, inform and terminate cooldown code. - if (entry.getValue() > System.currentTimeMillis()) { - final String commandCooldownTime = DateUtil.formatDateDiff(entry.getValue()); - user.sendTl("commandCooldown", commandCooldownTime); - cooldownFound = true; - event.setCancelled(true); - break; - } + final String commandCooldownTime = DateUtil.formatDateDiff(entry.getValue()); + user.sendTl("commandCooldown", commandCooldownTime); + cooldownFound = true; + event.setCancelled(true); } }