1.12.2 How can I use stuff in 'net.minecraft.server.v1_12_R1' across different versions?

Discussion in 'Spigot Plugin Development' started by Endode, Feb 17, 2020.

  1. I want to use some stuff in 'net.minecraft.server.v1_12_R1' but I want my plugin to work in 1.15.2 and other versions. I am building my plugin for 1.12.2 and want it to work in other versions.
     
  2. Youll need to create a class that handles all the different version (since class path and methods are changed almost every version)
     

  3. String test = "net.minecraft.server." + Bukkit.getServer().getVersion(); + "any else.."

    try this :D
     
  4. You'll either have to use reflection or separate gradle/maven modules to import multiple jars. If you want to go the multiple modules route, you can look at the HolographicDisplays repository for a little guidance: https://github.com/filoghost/HolographicDisplays/tree/master/NMS
     
    • Agree Agree x 1
  5. This will also work, but some methods or variables name will be different based on the version.
     
  6. i know :p
     
    • Useful Useful x 1
  7. md_5

    Administrator Developer

    What stuff? This is typical xyproblem
     
    • Agree Agree x 3