If you’re relying on old or bad quality YouTube videos I would personally recommend you to try out MineAcademy.
It’s the place where you can learn how to code in Java, and make Minecraft plugins from setting setting up the plugins for the IDE to setting up the project to going through each topic of making the Minecraft plugin using foundation. I would recommend you giving it a try and make a plugin out of it since it covers a lot.