Added core client cleanup in case of weird glitch from bungee
This commit is contained in:
parent
1cdb89f4bf
commit
922d269a52
@ -1,6 +1,8 @@
|
||||
package mineplex.core.account;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.account.event.AsyncClientLoadEvent;
|
||||
import mineplex.core.account.event.ClientUnloadEvent;
|
||||
@ -10,6 +12,8 @@ import mineplex.core.account.repository.token.ClientToken;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
|
||||
@ -220,4 +224,17 @@ public class CoreClientManager implements Listener
|
||||
}
|
||||
}, name, rank, perm);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void cleanGlitchedClients(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SLOW)
|
||||
return;
|
||||
|
||||
for (Iterator<Entry<String, CoreClient>> clientIterator = _clientList.entrySet().iterator(); clientIterator.hasNext();)
|
||||
{
|
||||
if (!clientIterator.next().getValue().GetPlayer().isOnline())
|
||||
clientIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user