Fix a concurrent modification error when removing all attachments.

This commit is contained in:
ElgarL 2012-04-07 17:21:48 +01:00
parent 1c0a5c49a5
commit e8dd963545
2 changed files with 8 additions and 3 deletions

View file

@ -167,3 +167,4 @@ v 2.0:
- Don't throw errors when attempting to remove permission attachments (bukkit will have already removed it). - Don't throw errors when attempting to remove permission attachments (bukkit will have already removed it).
- Remove all permission attachments when performing a manload or restart. - Remove all permission attachments when performing a manload or restart.
- Expand 'manwhois' to also list a users subgroups. - Expand 'manwhois' to also list a users subgroups.
- Fix a concurrent modification error when removing all attachments.

View file

@ -20,6 +20,7 @@ import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -368,8 +369,11 @@ public class BukkitPermissions {
*/ */
public void removeAllAttachments() { public void removeAllAttachments() {
for (Player player : attachments.keySet()) Iterator<Player> itr = attachments.keySet().iterator();
removeAttachment(player);
while (itr.hasNext()){
removeAttachment(itr.next());
}
} }
/** /**