using System.Net.Sockets; using Shared.Packet.Packets; namespace Server; public class Client : IDisposable { public readonly Dictionary Metadata = new Dictionary(); // can be used to store any information about a player public bool Connected = false; public CostumePacket CurrentCostume = new CostumePacket { BodyName = "", CapName = "" }; public Guid Id; public Socket? Socket; public void Dispose() { Socket?.Disconnect(false); } public async Task Send(Memory data) { if (!Connected) return; await Socket!.SendAsync(data, SocketFlags.None); } public static bool operator ==(Client? left, Client? right) { return left is { } leftClient && right is { } rightClient && leftClient.Id == rightClient.Id; } public static bool operator !=(Client? left, Client? right) { return !(left == right); } }