Moar magical fixes!

This will automagically fix bugged players who have joined multiple
parties.
This commit is contained in:
TfT_02 2013-04-13 01:17:07 +02:00
parent cb133ced80
commit 1b4eda713f

View File

@ -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.List;
import java.util.Map.Entry;
import org.bukkit.OfflinePlayer;
@ -20,6 +22,7 @@ public class PartyAutoKickTask extends BukkitRunnable {
private void updatePartyMembers() {
HashMap<OfflinePlayer, Party> toRemove = new HashMap<OfflinePlayer, Party>();
List<String> processedPlayers = new ArrayList<String>();
long currentTime = System.currentTimeMillis();
long kickTime = 24L * 60L * 60L * 1000L * Config.getInstance().getAutoPartyKickTime();
@ -30,9 +33,13 @@ public class PartyAutoKickTask extends BukkitRunnable {
for (String memberName : party.getMembers()) {
OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberName);
if (currentTime - member.getLastPlayed() > kickTime) {
if ((currentTime - member.getLastPlayed() > kickTime) || processedPlayers.contains(memberName)) {
toRemove.put(member, party);
}
if (!processedPlayers.contains(memberName)) {
processedPlayers.add(memberName);
}
}
}