A man who pleaded guilty to dealing drugs and using a stolen gun as protection said he started selling after losing his job during the COVID-19 pandemic.