I'm really really sorry you're going through this, I know what it's like. What you're going through is not a waste, you will learn much more from this than partying all the time and being constantly happy. Most people, especially lucky ones who effortlessly make friends, don't think about improving themselves much at all, not in any meaningful way.
I didn't try improve myself in second year so you're WAY ahead of me and you have a very long time to still get what you want out of uni, if I had decided to change in second year I know I'd have gotten everything I wanted (just like you will!)
It would be great if uni could be the best time of everyone's life, but even if it's not that doesn't mean you have to miss out on anything. In a decade it will be a distant memory you hardly remember like primary school is now. If you're into club music you might know that people are still going out raving well into their 30s and 40s (and they have the best time
)
Finding the strength to overcome these issues might seem impossible, but as long as you don't give up hope then you WILL get there. You will meet amazing people, have amazing sex, and have the best time with friends who love you, as well as fall in love several times. That's not happening tonight, and that's okay, because being lonely now means that you will appreciate and understand friendship on a whole other level when you find it, in a way other people could only wish for.
We need friendships as humans, but you should also know that friendships do not make you happy, neither does sex or relationships. In fact, relationships tend to make people very unhappy a lot of the time. It feels unfair to be left out on these basic things everyone else has, but when you truly appreciate that they don't make you happy, it's much harder to care. You have already found the key to happiness, which is focusing on becoming the best version of yourself.
It's tempting to say you will improve next week, but please try now. Your uni probably has a student support service, and I know that social anxiety makes it very hard to force yourself to go, but many people have these problems and that's why the support service is there, this is exactly their job, they are trained adult professionals at treating loneliness and if you can bring yourself to go there's a good chance they will change your life (depending on what uni)
In the moments like now, before you have made the change, force yourself to surround yourself with things that make you happy. Positive music, your fav tv shows, anything. And make the decision: 'tomorrow I will go to the support service'. Once you make the decision and plan for it, the job is done.
If you want to add me on facebook let me know or if you want to message me on here I will reveal my identity
Sorry for writing so much
I hope some of this encourages you to ask for things, be it friends or help and support.