I'm trying to use reflect in my plugin.
But I don't know how to get bukkit, or NMS versions like v1_8_R1, v1_7_R4 and so on.
Is there any way to get this kind of things? Or I need to use a switch to detect it using Bukkit.getVerion(); ?
You need to get package name of any NMS or CB class.
Example below takes normal bukkit server instance plugin.getServer()
and gets the class which is CraftServer and reads the version from package.
public static String getVersion(Server server) {
final String packageName = server.getClass().getPackage().getName();
return packageName.substring(packageName.lastIndexOf('.') + 1);
}