mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Moar magical fixes!
This will automagically fix bugged players who have joined multiple parties.
This commit is contained in:
parent
cb133ced80
commit
1b4eda713f
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user