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 incidenthappened 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.
Over the next two months, Pomana sent the victim approximately 30 Facebook messages that were 'abusive and threatening'. Two of the messages referred to killing the victim's children.
On May 27, Pomana was seen by police riding a motorcycle with no helmet and no lights. A breath test showed him to have 450mcg in his system, the legal limit being 250mcg.
Pomana pleaded guilty to possessing an offensive weapon, threatening to kill or do grievous bodily harm, driving with excess breath alcohol, and breaching court release conditions.
Judge Philip Crayton said Pomana had "a very poor record".
"It's to your credit that you didn't go beyond those messages and you did, once you had cooled off, stop and perhaps think about it, but this is really the last chance you're going to get."
He fined Pomana $400, disqualified him from driving for six months, and sentenced him to 250 hours of community work.