Man avoids jail after firing gun at neighbour