Permalink
Browse files

ACTUALLY fix our CME.

  • Loading branch information...
1 parent 287842c commit 0118346aaff4e3aa1d7b66f9a94546649a5f7ddd @gmcferrin gmcferrin committed Mar 27, 2013
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/main/java/com/gmail/nossr50/runnables/party/PartyAutoKickTask.java
@@ -1,7 +1,9 @@
package com.gmail.nossr50.runnables.party;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map.Entry;
import org.bukkit.OfflinePlayer;
import org.bukkit.scheduler.BukkitRunnable;
@@ -17,18 +19,23 @@ public void run() {
}
private void updatePartyMembers() {
+ HashMap<OfflinePlayer, Party> toRemove = new HashMap<OfflinePlayer, Party>();
+
long currentTime = System.currentTimeMillis();
long kickTime = 24L * 60L * 60L * 1000L * Config.getInstance().getAutoPartyKickTime();
for (Iterator<Party> partyIterator = PartyManager.getParties().iterator(); partyIterator.hasNext();) {
Party party = partyIterator.next();
for (OfflinePlayer member : new ArrayList<OfflinePlayer>(party.getMembers())) {
-
if (currentTime - member.getLastPlayed() > kickTime) {
- PartyManager.removeFromParty(member, party);
+ toRemove.put(member, party);
}
}
}
+
+ for (Entry<OfflinePlayer, Party> entry : toRemove.entrySet()) {
+ PartyManager.removeFromParty(entry.getKey(), entry.getValue());
+ }
}
}

0 comments on commit 0118346

Please sign in to comment.