public async Task SendPacketAsync(IPacket packet) { if (!Connected) { throw new ProtocolException("Connection error: Not connected to server."); } await _stream.SendPacketAsync(packet); if (SavePackets) { PacketsSended.Add(packet); } }