Barney & Friends is a children's show known for its positive and educational messages. Violence, especially against its main character, is not something the show would depict.
It's possible you are thinking of a different show or a dream you had. If you have any other details about this episode, I might be able to help you figure out what you're thinking of.