try method of higher bukkit version

M

MightyOne

Guest
#1
Hi,
Since spigot 1.12 ItemMeta supports the method setUnbreakable(). It is a cool feature but to make my plugin usable for earlier version. So I just wanted to use the method like:
Code:

try {
meta.setUnbreakable(true);
} catch (Exception e) {}
buuuuuuut it is throwing a NoSuchMethodError while loading the plugin anyway xD
I had no idea what to search for so I wrote this.

Does anybody have an idea how to maybe achieve compatibility for multiple versions? Or is there a better way?...

try method of higher bukkit version