Debate:Comet Ping Pong Shooter's sentence

Did he deserve the four year sentence?
So, I was reading some old news articles when I found out this guy´s sentence. Four years. Four years of this guy´s life is going to be spent in jail because he walked into a pizza shop with a gun because he thought children were being sexually abused. When he realized he was wrong, he set down his weapon and turned himself in peacefully. Yes, he was being stupid, but he was trying to be a good person. He didn´t hurt anyone, and didn´t destroy any property. So, why the four year sentence? I don´t know a lot about law, but it seems like he should just be doing community service or something.