mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
ACTUALLY fix our CME.
This commit is contained in:
parent
287842c675
commit
0118346aaf
@ -1,7 +1,9 @@
|
|||||||
package com.gmail.nossr50.runnables.party;
|
package com.gmail.nossr50.runnables.party;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
@ -17,6 +19,8 @@ public class PartyAutoKickTask extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updatePartyMembers() {
|
private void updatePartyMembers() {
|
||||||
|
HashMap<OfflinePlayer, Party> toRemove = new HashMap<OfflinePlayer, Party>();
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
@ -24,11 +28,14 @@ public class PartyAutoKickTask extends BukkitRunnable {
|
|||||||
Party party = partyIterator.next();
|
Party party = partyIterator.next();
|
||||||
|
|
||||||
for (OfflinePlayer member : new ArrayList<OfflinePlayer>(party.getMembers())) {
|
for (OfflinePlayer member : new ArrayList<OfflinePlayer>(party.getMembers())) {
|
||||||
|
|
||||||
if (currentTime - member.getLastPlayed() > kickTime) {
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user