clanchatplugin: fix issue 1407, UnsupportedOperationException (#1411)

* clanchatplugin: fix issue 1407, UnsupportedOperationException

* Fixed concurrentmodification exception
This commit is contained in:
Damhan Richardson
2019-08-22 14:21:05 +01:00
committed by Kyle
parent 4b4af0fa2b
commit 491c8b12fb

View File

@@ -259,14 +259,13 @@ public class ClanChatPlugin extends Plugin
if (member.getWorld() == client.getWorld())
{
final String memberName = Text.toJagexName(member.getUsername());
final Iterator<Player> each = clanMembers.iterator();
while (each.hasNext())
List<Player> toRemove = new ArrayList<>();
for (Player each : clanMembers)
{
if (memberName.equals(Text.toJagexName(each.next().getName())))
if (memberName.equals(Text.toJagexName(each.getName())))
{
each.remove();
toRemove.add(each);
if (clanMembers.isEmpty())
{
removeClanCounter();
@@ -275,6 +274,7 @@ public class ClanChatPlugin extends Plugin
break;
}
}
clanMembers.removeAll(toRemove);
}
if (!this.showJoinLeave ||