diff --git a/QSB/Player/QSBPlayerManager.cs b/QSB/Player/QSBPlayerManager.cs index ad57497b..4cf39f10 100644 --- a/QSB/Player/QSBPlayerManager.cs +++ b/QSB/Player/QSBPlayerManager.cs @@ -126,68 +126,4 @@ public static class QSBPlayerManager public static IEnumerable<(PlayerInfo Player, IQSBItem HeldItem)> GetPlayerCarryItems() => PlayerList.Select(x => (x, x.HeldItem)); - - private static Dictionary _connectionIdToPlayer = new(); - - public static IEnumerator ValidatePlayers() - { - // BUG: this does not work. try using a ping (heartbeat) message to detect whether the player actually exists. if they dont, kick the player. - while (true) - { - if (QSBCore.IsInMultiplayer && QSBCore.IsHost) - { - _connectionIdToPlayer.Clear(); - - var playersToRemove = new List(); - - foreach (var player in PlayerList) - { - var transformSync = player.TransformSync; - - if (transformSync == null) - { - DebugLog.ToConsole($"Error - {player.PlayerId}'s TransformSync is null.", MessageType.Error); - playersToRemove.Add(player); - continue; - } - - var networkIdentity = transformSync.netIdentity; - - if (networkIdentity == null) - { - DebugLog.ToConsole($"Error - {player.PlayerId}'s TransformSync's NetworkIdentity is null.", MessageType.Error); - playersToRemove.Add(player); - continue; - } - - var connectionToClient = networkIdentity.connectionToClient; - - if (_connectionIdToPlayer.ContainsKey(connectionToClient.connectionId)) - { - // oh god oh fuck - DebugLog.ToConsole($"Error - {player.PlayerId}'s connectionToClient.connectionId is already being used?!?", MessageType.Error); - playersToRemove.Add(player); - continue; - } - - _connectionIdToPlayer.Add(connectionToClient.connectionId, player); - } - - if (playersToRemove.Count != 0) - { - DebugLog.DebugWrite($"Removing {playersToRemove.Count} invalid players.", MessageType.Success); - - foreach (var player in playersToRemove) - { - OnRemovePlayer?.Invoke(player); - player.HudMarker?.Remove(); - PlayerList.Remove(player); - DebugLog.DebugWrite($"Remove Invalid Player : {player}", MessageType.Info); - } - } - } - - yield return new WaitForSecondsRealtime(5); - } - } } \ No newline at end of file diff --git a/QSB/QSBCore.cs b/QSB/QSBCore.cs index b8b9429f..bf314d40 100644 --- a/QSB/QSBCore.cs +++ b/QSB/QSBCore.cs @@ -188,8 +188,6 @@ public class QSBCore : ModBehaviour QSBWorldSync.Managers = components.OfType().ToArray(); QSBPatchManager.OnPatchType += OnPatchType; QSBPatchManager.OnUnpatchType += OnUnpatchType; - - StartCoroutine(QSBPlayerManager.ValidatePlayers()); } private static void OnPatchType(QSBPatchTypes type)