I’m confused

Okay so 3 years ago I liked this guy lets call him Z. Z is my guy friend’s cousin who I’m best friends with. We only talked online really, nothing ever happened. Last year was the first time we met. It was me, Z, his cousin/my friend, and my girl friend let’s call her K. K had a boyfriend at the time and I was long over Z but it was nice to see him in person. I was sorted hoping we’d hang out more then date and it’d bring up old feelings but things took a turn. About two months later K and her bf broke up and she started dating Z. I was disappointed but kinda expected it Bc K always get the guys. However K and I drifted Bc she only spent time with Z and never made time for me anymore and we got into a hugeeee fight. Couple months later they break up and K and I are slowly talking again. Z and I weren’t the closest, but we were still able to talk about anything Bc we had a lot in common. Z said he wanted to hangout with me, HE ASKED ME, and I felt a little uncomfortable going by myself Bc idk if he was gonna try something. So his cousin/my guy friend was gonna come but then K found out and it became this whole bigger mess of who said what and all that. So Z and I never hung out and he said he didn’t want to be friends w me for a bit. K told me she didn’t like me talking to Z but he and I were internet friends for a long time and Z’s cousin isn’t going to stop being cousins with him Bc they broke up so why should I let their breakup effect who I talk to or not??? It’s not like I would date him Bc that’s wrong and I wouldn’t do that, but I should be able to at least talk to him. So later on he forgave me and said their relationship was toxic Bc apparently K cheated on him with her ex Bc K is more experienced and wanted sex and stuff but Z is kinda prude and wasn’t giving it to her. I mean there’s two sides to every story but she would complain to me that Z wasn’t having sex with her but wouldn’t break up with him so maybe she did cheat on him maybe not. And Z and I became friends again and asked to hangout again (but this time I know he’s interested in a different girl from elsewhere) but he’s terrible at planning it so we still haven’t. So anyways a few months later into present day today, K, Z, and his cousin ARE ALL HANGING OUT. WITHOUT ME. Like WTFFFF. How the fuck are you gonna hangout with someone who destroyed your trust and many friendships??? I don’t understand. I’m just so confused.