public override void Handle(HandshakeMessage message) { string clientId = message.Sender.ToString(); if (!_server.HasClient(clientId)) { ControlledPlayer player = _spawner.SpawnControlledPlayer(_playerRegistry.GetNextTeamAssignment()); _playerRegistry.RegisterPlayer(player, clientId); _server.RegisterClient(clientId, message.Sender); } else { Debug.LogWarning("Client with this id is already connected."); } var serverPlayer = _playerRegistry.GetControlledPlayerByClientId(clientId); var spawnMessage = new SpawnPlayerMessage(clientId, serverPlayer.PlayerId, serverPlayer.Team); _server.SendMessage(spawnMessage, message.Sender); }