Gun-carrying felon sentenced to maximum prison term