using System.Collections; using UnityEngine; namespace CLre_server.API.Synergy { internal static class CLreEnforcer { private const float _waitTime = 10.0f; public static IEnumerator WaitABitForHandshakeThenKick(int playerId) { float elapsedTime = 0.0f; while (elapsedTime < _waitTime) { yield return null; elapsedTime += Time.deltaTime; } yield return null; if (Clients.IsConnected(playerId) && !Clients.IsCLreClient(playerId)) { MainServer.UserVerification.Instance.DisconnectPlayer(playerId); } } internal static void Init() { if (CLre_server.CLre.Config.clre_clients_only) { MainServer.Server.Instance.PlayerConnect += (_, playerData) => { WaitABitForHandshakeThenKick(playerData.PlayerId).Run(); }; } } } }