From 1b4eda713f1c954190ddd0ccb5848ddaa1e7132f Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Sat, 13 Apr 2013 01:17:07 +0200 Subject: [PATCH] Moar magical fixes! This will automagically fix bugged players who have joined multiple parties. --- .../gmail/nossr50/runnables/party/PartyAutoKickTask.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/runnables/party/PartyAutoKickTask.java b/src/main/java/com/gmail/nossr50/runnables/party/PartyAutoKickTask.java index d4f8e485d..5609d6b8c 100644 --- a/src/main/java/com/gmail/nossr50/runnables/party/PartyAutoKickTask.java +++ b/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.List; import java.util.Map.Entry; import org.bukkit.OfflinePlayer; @@ -20,6 +22,7 @@ public class PartyAutoKickTask extends BukkitRunnable { private void updatePartyMembers() { HashMap toRemove = new HashMap(); + List processedPlayers = new ArrayList(); 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); + } } }