Defendant pleads guilty to threatening to shoot prosecutor