This API used to be version-dependent, but since v2.0, that's fixed.
Compatible versions:
- 1.8.x
- 1.9.x
You need to add the following code into your onEnable() method:
Code (Text):
NMSSetupResponse nmsSetupResponse = JSON.setup(this);
if (nmsSetupResponse.isCompatible())
getLogger().info("[VersionManager] Hooked server version " + nmsSetupResponse.getVersion());
else
{
getLogger().warning("[VersionManager] Your server version (" + (nmsSetupResponse.getVersion() == null ? "UNKNOWN" : nmsSetupResponse.getVersion()) + ") is not compatible with this plugin!");
getServer().getPluginManager().disablePlugin(this);
return;
}