I think you need to have counsel with your heart when that happens to try to understand what you are trying to accomplish by hating and being resentful. In other words, instead of trying to obey "DO NOT HATE!" admit your hatred/resentment, defend it if necessary, and then with a conscience towards GOD ask yourself "What does this accomplish?" You will probably hear your heart say, "I'm hurt". The holy spirit will be there to help you. Be honest.
I already know what I am trying to accomplish by hating and being resentful. I'm trying to murder them! And it's even worse than that - I'm trying to hide my murder just like Cain did! But it's not very successful, because then the person will eventually say: hey, are you mad at me...? And I'll say: no, I'm not mad. So I lie about having been mad because deep down I know it's wrong. But I'm supposed to walk in truth and instead I just walked in deceitfulness and didn't admit the truth that I was mad. Yet I say I walk in the light but am walking in darkness. And I've seen that if I go on in that manner, it becomes to where I get hardened to it and can't see it very clearly.
And yes, it's usually because I'm hurt by the way they treated me. And I have the spirit on hurt feelings too - they are hurt pride. A pride that demands and thinks it has the right to be treated well and with honor. But that's sickening. No man owes me any honor. I think too highly of myself - a little Napolean.