public void VerifyUser(int fromClient, Dictionary <string, object> userData) { int _clientId = int.Parse(userData["id"].ToString()); string _username = userData["username"].ToString(); string _secret = userData["secret"].ToString(); try { if (fromClient != _clientId) { Debug.Log($"Player \"{_username}\" (ID: {fromClient}) has assumed the wrong client ID ({_clientId})!"); } else { Server.clients[_clientId].remoteKey = Cryptograph.StringToKey(_secret); Debug.Log($"{Server.clients[_clientId].tcp.socket.Client.RemoteEndPoint} connected successfully and is now player {_clientId}."); Misc.MakeWebRequest( this, new Action <object, object>((webout, isError) => { if (!(bool)isError) { Server.clients[_clientId].loginHash = webout.ToString(); } }), new Tuple <string, string>[] { new Tuple <string, string>("target", "getHash"), new Tuple <string, string>("username", _username) }); EntityHandler.InstantiateEntity <Player>(_clientId, _username); } } catch (System.NullReferenceException ex) { Debug.Log($"An error ocurred during parsing some packet data ex: {ex.Message}"); } }