Fixed ConcurrentModification for ServerManager cooldowns.

This commit is contained in:
Jonathan Williams 2015-08-05 01:33:09 -05:00
parent 95bb4ab04b
commit da5387c54f

View File

@ -9,6 +9,7 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
@ -559,13 +560,13 @@ public class ServerManager extends MiniPlugin
private void updateCooldowns() private void updateCooldowns()
{ {
for (String playerName : _queueCooldowns.keySet()) for (Iterator<String> playerIterator = _queueCooldowns.keySet().iterator(); playerIterator.hasNext();)
{ {
Player player = Bukkit.getPlayer(playerName); Player player = Bukkit.getPlayer(playerIterator.next());
if (player == null || !isOnCooldown(player)) if (player == null || !isOnCooldown(player))
{ {
_queueCooldowns.remove(playerName); playerIterator.remove();
} }
} }
} }