//called once a client disconnects from the server void OnDisconnected(INetworkPlayer player) { if (logger.LogEnabled()) { logger.Log("Server disconnect client:" + player); } // set the flag first so we dont try to send any messages to the disconnected // connection as they wouldn't get them player.MarkAsDisconnected(); RemoveConnection(player); Disconnected?.Invoke(player); player.DestroyOwnedObjects(); player.Identity = null; if (player == LocalPlayer) { LocalPlayer = null; } }