2 Versions of plugin in one JAR

Discussion in 'Spigot Plugin Development' started by snadol, Oct 14, 2018.

  1. Is there a way to have a 1.13 and a <1.13 version of my plugin in one jar file and have the 1.13 one activated if on 1.13 and if not then have the <1.13 one activated?
     
  2. Yes but why do you need to do that?
     
  3. It's clean, rather than having 2 different jar files, and makes my IDE more organized. Can you get me started on how to do that (not asking for spoonfeed)?
     
  4. I've looked that up and I'm completely lost.
     
  5. Maven or Gradle Modules i think is possible with ant too, not sure :B
     
  6. I understand that, really I meant what do you need to do that for?

    Are you using nms and do you mind sharing your code?
     
  7. Use Maven and add at dependencies 1.13.1 version. It will be work. But if you use NMS, I think you can’t
     
  8. It is technically possible but not feasible. Your plugin.yml is basically just a file sitting on the upper most level from your jar. Since you have to declare that you are using the 1.13 api there you need two versions of the file. Aka you have to change the file structure of your jar on the fly. This is not possible from inside your Main class because the plugin.yml always gets loaded first. So you would have to create a wrapper for spigot or maybe a custom start script with some tinkering to change your plugin.jar before spigot/Bukkit launches.
    It is easier for everyone involved to keep 2 separate jars for both api versions.
     

Share This Page