Thomas Smith threatened to “bang the man out” before hurling the makeshift weapon at the wall of her Fritchley Court flat, at 3pm on September 2.
“She didn’t know what he was going to do as he had made threats before,” said prosecutor Ruth Snodin.
Friends stopped Smith from chasing the man further than a short distance, the court heard, but he returned to her flat two days later, and jammed his foot into her door.
A staff member told him to leave, and when the woman locked herself in her room, he started banging and kicking on her door.
He “shoulder barged” the staff member out of the way and began banging on the doors in her flat.
Smith shouted: “You better let me in or you know I will break the door down. I will beat you up.”
He was evicted from the supported accommodation for young people, run by the housing charity Framework, later that evening, the court heard.
Smith, 18, now of Prospect Street, admitted using violence to secure entry to premises, threatening or abusive behaviour, and assault when he appeared at Mansfield Magistrates Court, on Wednesday.
The court heard he received cautions for like offences, and was given a two year conditional discharge and a fine, in August 2017, for driminal damage.
Michael Little, mitigating, said Smith and the young woman became “good friends” while they were living at the same complex of flats, but things “got really weird” when she talked to other boyfriends on the phone while he sat on her bed.
On September 2, he said her new boyfriend made “unpleasant comments” about Smith, and goaded him by sticking up his middle finger.
He said Smith “lost his head for some unknown reason” and chased him with the hammer.
On September 4, Smith was invited to the flat, Mr Little said.
“He has now identified a real issue as far as anger management is concerned,” Mr Little said.
He explained that Smith’s behaviour stemmed from him getting bullied at school, and he had sought counselling from his GP.
Smith was given a 12 month community order, with 20 days of a rehabilitation activity requirement, and he must carry out 60 hours of unpaid work.
He was banned from Fritchley Court by a restraining order for two years, and was ordered to pay £50 compensation each to his two victims, and £85 court costs.