The Fosters season 4 premiere starts seconds after the season finale.
We see Callie in the office with the mama's where she is explaining her relationship with Brandon, and Nick has his father's gun in his backpack at this time. Walks into school talk to Jesus and lends him his car for a period. Mariana talks with Nick for a short time before a security finds them in a courtyard and tells them to get to class. Mariana goes to the bathroom and finishes up right as the school is placed on lock-down. Nick's father is in the office and is telling them that he is suing the school for the unauthorized use of his warehouse that they utilized for the musical. Telling Lena that it burned down, they go out to Nick's father's car where his gun was locked up, and it's not there so now the school is forced into a lock down. Everyone is accounted for except for Mariana who just missed getting in a room before it was a complete lock down, she knocked on many doors until finally heading into the bathroom to hide in a stall.
Brandon and Callie are forced into a junior high classroom, and they took over the teachers job with helping get the classroom students calm.
We see the swat team come, and slowly all the classrooms are evacuated.
We find out that the junior high teacher that Brandon and Callie were helping had a gun on him and when the swat team came into the room he had fired his gun not knowing that help was there. He gets put in handcuffs, and the classroom gets evacuated. Swat teams finally get ahold of Mariana's whereabouts and escort her out to the meeting area. The closing of this episode shows that Nick is at the Foster's house hiding out somewhere, and Stef makes sure its safe.
This whole episode was centered around a very real thing that keeps happening. Guns are no laughing matter, and they do kill and hurt people.