Riccardo Nathaniel Donalds was ordered to do 200 hours of unpaid work and pay compensation after being convicted following his arrest in February.
According to North Yorkshire Police, officers were called to Westbourne Grove, Scarborough, following reports of anti-social behaviour and suspected drug use.
When police attended the property they saw Donalds, 29, of Creed Way, West Bromwich, jumping down from a first-floor window of the flat having smashed the window.
They went to the back of the premises and, after a violent altercation where he resisted arrest and assaulted one of the officers, Donalds was arrested.
When he was taken into custody, Donalds was found to be in possession of drugs, which was the reason he was trying to evade capture. The flat was searched by police and it was clear the flat was being used for the consumption of illegal drugs, police say.
Donalds admitted possessing crack cocaine, heroin and cannabis, criminal damage and assaulting a police officer during a hearing at Scarborough Magistrates’ Court.
Detective Constable David Adams, from North Yorkshire Police’s Scarborough Investigation Hub, said: “Donalds had no respect for the police or the law and, when caught, he tried to resist and seriously injure the arresting officer by physically assaulting him.
“Police accept when working that there is a risk in what we do and it is the job that we chose. However, officers serving and protecting the public do not expect to go to work and be seriously assaulted in the course of their duty when lawfully doing their job.
“I commend this officer for his bravery and courage when facing a violent man like Donalds.”