

You probably want to stick to building your plugin with whichever JDK is the minimum for the minimum Minecraft version you want to support. For instance, if you want to support all the way back to 1.18, you should build with Java 17. If you only want to support 1.20.5 or later, then you can use Java 21.
I thought they already did this a couple years ago