Need help 😭😭😭

My boyfriend dumped me 2 months ago and then didn't talk to me the rest of the summer, then school started and he was being all nice to me and stuff, I thought I was over him but I caught feelings again 😭 and then he started being all nasty again and hurting my feelings and stuff, saying mean things to me to insult me, getting other girls numbers, etc. How do I get over him??? I can't avoid him because we have so many classes together... 😭😭 I don't want to like him but I do and I hate myself for it