Ryan Flores was found guilty last month on two charges after he attempted to rob a Starbucks in Fresno with a fake gun and a knife before being injured by a Good Samaritan.
Flores was sentenced to four years in prison on Wednesday morning, but will be eligible for parole in 2019.
Flores walked into a Starbucks in July wearing a Transformers mask with a built-in voice changer. He pointed a replica gun, then a knife at the cashier and told her to give him all of his money.
That's when Cregg Jerri stepped in and crashed a chair over Flores' back.
In the end, both Flores and Jerri were injured.
Flores has threatened to sue Jerri for his injuries.