Changed checkVersion() to getNMSHandler() & fixed it

This commit is contained in:
Florian CUNY 2017-05-24 11:48:32 +02:00 committed by GitHub
parent a0aea999f1
commit e00b925447
1 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,7 @@ public class Util {
* @throws InvocationTargetException * @throws InvocationTargetException
* @throws NoSuchMethodException * @throws NoSuchMethodException
*/ */
public static NMSAbstraction checkVersion() throws ClassNotFoundException, IllegalArgumentException, public static NMSAbstraction getNMSHandler() throws ClassNotFoundException, IllegalArgumentException,
SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException,
NoSuchMethodException { NoSuchMethodException {
String serverPackageName = plugin.getServer().getClass().getPackage().getName(); String serverPackageName = plugin.getServer().getClass().getPackage().getName();
@ -44,10 +44,10 @@ public class Util {
String version = serverPackageName.substring(serverPackageName.lastIndexOf('.') + 1); String version = serverPackageName.substring(serverPackageName.lastIndexOf('.') + 1);
Class<?> clazz; Class<?> clazz;
try { try {
clazz = Class.forName(pluginPackageName + ".nms." + version + ".NMSHandler"); clazz = Class.forName(pluginPackageName + ".util.nms." + version + ".NMSHandler");
} catch (Exception e) { } catch (Exception e) {
plugin.getLogger().info("No NMS Handler found for " + version + ", falling back to Bukkit API."); plugin.getLogger().info("No NMS Handler found for " + version + ", falling back to Bukkit API.");
clazz = Class.forName(pluginPackageName + ".nms.fallback.NMSHandler"); clazz = Class.forName(pluginPackageName + ".util.nms.fallback.NMSHandler");
} }
// Check if we have a NMSAbstraction implementing class at that location. // Check if we have a NMSAbstraction implementing class at that location.
if (NMSAbstraction.class.isAssignableFrom(clazz)) { if (NMSAbstraction.class.isAssignableFrom(clazz)) {