Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by RestrictedPower, Apr 15, 2016.
Hey how could I make a plugin compatible for both 1.8 and 1.9 versions?
You make a base abstract class and load the implementation of that class based on the server version. So like MobsSpawnerAbs -> MobsSpawnerImpl_1_9 or 1_8
if you only use the api (and no new 1.9 api) you should be fine.
Only problem I can see is the changed Sound enum. For that you will just need to check which verison the server is running and access the sounds for each version using Sound.valueOf(name) instead of Sound.name
So if I understood well I should check the version and then import for the version's api?
most of the parts of the api did not break from 1.8 to 1.9, only thing I can think of are sounds. What feature doesn't work for you? Are you accessing obc/nms classes?
Nothing I haven't tried yet I just thought that if the server is in 1.9 and the pl in 1.8 there would be an error just by loading the plugin...
well, the api is designed to not break on updates. so in most cases there is no need to update your plugin at all. I workflow here is to try every feature of you plugin with the new version and then try to fix stuff the broke. If nothing broke you are good to go and don't need to change anything.