A 24-year-old man accused of plotting to carry out a public shooting in Sydney has been arrested just hours after a terrifying late-night raid.