package com.gmail.nossr50.party.runnables;

import org.bukkit.OfflinePlayer;

import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.party.PartyManager;

public class PartyAutoKick implements Runnable {
    @Override
    public void run() {
        updatePartyMembers();
    }

    private void updatePartyMembers() {
        long currentTime = System.currentTimeMillis();
        long kickTime = 24L * 60L * 60L * 1000L * Config.getInstance().getAutoPartyKickTime();

        for (Party party : PartyManager.getParties()) {
            for (OfflinePlayer member : party.getMembers()) {
                if (currentTime - member.getLastPlayed() > kickTime) {
                    PartyManager.removeFromParty(member, party);
                }
            }
        }
    }
}

@@ -37,16 +37,45 @@
 ables;%0A%0A
+import java.util.ArrayList;%0A%0A
 import o
@@ -566,16 +566,37 @@
 party : 
+new ArrayList%3CParty%3E(
 PartyMan
@@ -609,24 +609,25 @@
 etParties())
+)
  %7B%0A         
@@ -657,16 +657,45 @@
 ember : 
+new ArrayList%3COfflinePlayer%3E(
 party.ge
@@ -705,16 +705,17 @@
 mbers())
+)
  %7B%0A     

Fix a ConcurrentModificationException