A fan attending the Nets vs. Mavericks game on Thursday night ended up spending most of his evening in custody ... because he was arrested for throwing a cup of ice that nearly hit Luka Doncic on the court. According to the NYPD, 24-year-old Justin…