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); }