public static void HandlePacketLoginRequest(Client client, LoginRequestPacket packet) { if (!client.Owner.CheckUsername(packet.Username)) client.Kick("Inconsistent username"); else if (packet.ProtocolOrEntityId < ProtocolVersion) client.Kick("Outdated client"); else { if (client.Owner.Server.UseOfficalAuthentication) { try { string authenticated = Http.GetHttpResponse(new Uri(String.Format("http://www.minecraft.net/game/checkserver.jsp?user={0}&serverId={1}", packet.Username, client.Owner.Server.ServerHash))); if (authenticated != "YES") { client.Kick("Authentication failed"); return; } } catch (Exception exc) { client.Kick("Error while authenticating..."); client.Logger.Log(exc); return; } } client.SendLoginSequence(); } }