A man has admitted terrifying tow people in a York city centre coffee shop with an imitation firearm.