public static async Task HandleClientSettings(Client client, PacketReader reader) { //TODO: save these settings in Player string locale = await reader.ReadString(); byte viewDistance = await reader.ReadByte(); byte chatFlags = await reader.ReadByte(); byte difficulty = await reader.ReadByte(); bool cape = await reader.ReadBoolean(); }
public static async Task HandleHandshake(Client client, PacketReader reader) { byte protocol = await reader.ReadByte(); string username = await reader.ReadString(); string host = await reader.ReadString(); uint port = await reader.ReadUInt32(); // TODO: This has to happen as a seperate task!! not on this thread LoginResult res = client.Authenticate(username, host, port); if (res != LoginResult.LoggedIn) { using (var packet = new PacketWriter(SendOpcode.Kick)) { packet.WriteString("DERP!!! Server disconnected, reason: {0}", res.ToString()); client.Send(packet); } } else { //TODO: chunks? } }