Nothing others do is because of you. What others say and do is a projection of their own dream. When you are immune to the opinions and actions of others, you won't be the victim of needless suffering.
That rude customer at work. The school bully. Your mean professor who refuses to give you an A. You don't really know these people; you don't know what's going on in their lives, nor do you know what's going on in the heads of the people you do know. They could be dealing with something really difficult for them and maybe that's the reason they are taking it out on you. But whatever it is, it's not your fault and you shouldn't let it affect your peace of mind.
I used to come home from work in an awful mood after dealing with customer after customer for ten hours straight and probably only getting about ten total please's and thank-you's. Sometimes they wouldn't even look at me during the entire time I helped them. I couldn't understand how people can be so rude. Then one day a lady came through the drive-thru being really short with me. I ignored it and asked how her day was and she said, "well, I just found out my mom has cancer." I had no idea what to say to that, but from then on I never judged a customer again and instead tried my hardest to give them a smile now matter how rude they were to me.
There's another way to look at this. Say someone does something incredibly hurtful to you. Maybe a significant other cheated on you and then dumped you afterwards and never even apologized. It's okay to be heart-broken for a little while but when it all comes down to it, that's their problem, not yours. Mean people are never happy people and that is unfortunate for them that they will never know the true joy in being kind and compassionate to others. Don't let them bring you down or make you feel like you're not loved. Instead, take this time to be grateful that you're not that kind of person.
On a lighter note, I challenge you to start doing this on a regular basis. If someone says or does something that would normally offend you, don't let it. Smile right back to them and take pride in the fact that you're better than that.