mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Nicer way to handle the ConcurrentModification issue.
This commit is contained in:
parent
6c4ea34811
commit
4ce06de18a
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.party.runnables;
|
package com.gmail.nossr50.party.runnables;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
|
||||||
@ -18,8 +18,10 @@ public class PartyAutoKick implements Runnable {
|
|||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
long kickTime = 24L * 60L * 60L * 1000L * Config.getInstance().getAutoPartyKickTime();
|
long kickTime = 24L * 60L * 60L * 1000L * Config.getInstance().getAutoPartyKickTime();
|
||||||
|
|
||||||
for (Party party : new ArrayList<Party>(PartyManager.getParties())) {
|
for (Party party : PartyManager.getParties()) {
|
||||||
for (OfflinePlayer member : new ArrayList<OfflinePlayer>(party.getMembers())) {
|
for (Iterator<OfflinePlayer> memberIterator = party.getMembers().iterator(); memberIterator.hasNext();) {
|
||||||
|
OfflinePlayer member = memberIterator.next();
|
||||||
|
|
||||||
if (currentTime - member.getLastPlayed() > kickTime) {
|
if (currentTime - member.getLastPlayed() > kickTime) {
|
||||||
PartyManager.removeFromParty(member, party);
|
PartyManager.removeFromParty(member, party);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user