From 4ce06de18a387a44cce2b7723ee33ec3467a985c Mon Sep 17 00:00:00 2001 From: GJ Date: Fri, 15 Feb 2013 07:40:47 -0500 Subject: [PATCH] Nicer way to handle the ConcurrentModification issue. --- .../com/gmail/nossr50/party/runnables/PartyAutoKick.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/party/runnables/PartyAutoKick.java b/src/main/java/com/gmail/nossr50/party/runnables/PartyAutoKick.java index aff2886bc..691b85922 100644 --- a/src/main/java/com/gmail/nossr50/party/runnables/PartyAutoKick.java +++ b/src/main/java/com/gmail/nossr50/party/runnables/PartyAutoKick.java @@ -1,6 +1,6 @@ package com.gmail.nossr50.party.runnables; -import java.util.ArrayList; +import java.util.Iterator; import org.bukkit.OfflinePlayer; @@ -18,8 +18,10 @@ public class PartyAutoKick implements Runnable { long currentTime = System.currentTimeMillis(); long kickTime = 24L * 60L * 60L * 1000L * Config.getInstance().getAutoPartyKickTime(); - for (Party party : new ArrayList(PartyManager.getParties())) { - for (OfflinePlayer member : new ArrayList(party.getMembers())) { + for (Party party : PartyManager.getParties()) { + for (Iterator memberIterator = party.getMembers().iterator(); memberIterator.hasNext();) { + OfflinePlayer member = memberIterator.next(); + if (currentTime - member.getLastPlayed() > kickTime) { PartyManager.removeFromParty(member, party); }