A 17-year-old Texas teenager was behind bars Friday after a vigilant off-duty cop playing an online video game allegedly overheard the teen planning a shooting at his former high school.

Taylor police said Devan Y’Shaun Davis-Brooks was playing a video game early Wednesday morning and told other players he was going to shoot up Taylor High School.

The teen also started bragging about a previous arrest, also for threatening his former school, cops said.

Unbeknownst to the teenager, however, he was playing the game with an off-duty Fort Worth police officer, who reportedly heard the entire threat and immediately called Taylor police.

“When he made the threats, he referenced the fact that he had been involved in something before and advised to 'Google it and you’ll know who I am,’” Taylor police Commander Joseph Branson told FOX4 News.

TEXAS MAN ALLEGEDLY STABBED NEPHEW’S DOG BECAUSE IT KILLED HIS CHICKEN: REPORT

Davis-Brooks was arrested and charged with making a terrorist threat – a third-degree felony.

Police said his previous arrest came in August 2018 after he allegedly made similar threats. That arrest was a misdemeanor.

The Fort Worth Police Department said the police officer wishes to remain anonymous, but a spokesperson said the department is proud of his actions and for remaining vigilant, even while off duty.

Police did not say what online game the two were playing and did not reveal the specifics of the conversation.

CLICK HERE TO GET THE FOX NEWS APP

“It has to be what the average person would consider a legitimate threat,” criminal defense attorney and former prosecutor Toby Shook, who is not involved in the case, told FOX4 News. “Whether he was actually going to carry it out or not doesn’t matter. If it’s the type of threat and words used that would invoke that type of response in the public, that’s all it takes.

The teen remains in the Williamson County Jail on $25,000 bail.