I recently bought an old G1 Jetfire with a gun missing. Instead of spending $15 buying one online, I modeled one instead. Doesn't retract in and out, but works pretty well for the figure. You might need to sand down the handle slightly to get it to fit nicely, depending on your printer, but it shouldn't take much.
Printed mine at 0.3mm, 0.2 infill.