Michael William Pomana's victim hid in the toilet as Pomana stood outside his lounge window with a baseball bat, yelling for him to come out.
In the period afterwards, Pomana sent the victim numerous threatening messages, including ones where he said he would kill the victim's children.
The first incident happened on March 9, police prosecutor Sergeant Stephen Butler told the Whanganui District Court on Tuesday.
Pomana drove to the male victim's address and walked to the lounge window holding a baseball bat over his shoulder. He yelled out the victim's name and told him to come outside.
The victim locked himself in the toilet and called police. Pomana was gone by the time police arrived, Mr Butler said.