mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-03-09 21:29:17 +01:00
Changed checkVersion() to getNMSHandler() & fixed it
This commit is contained in:
parent
a0aea999f1
commit
e00b925447
@ -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)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user