|
@@ -124,17 +124,28 @@ public class CustomOreGen extends JavaPlugin {
|
|
* Acquires the corresponding skyblock hook class
|
|
* Acquires the corresponding skyblock hook class
|
|
*/
|
|
*/
|
|
private void loadHook() {
|
|
private void loadHook() {
|
|
- Exception loadException = null;
|
|
|
|
|
|
+ skyblockAPI = getHook();
|
|
|
|
+ skyblockAPICached = new SkyblockAPICached(skyblockAPI);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public SkyblockAPIHook getHook() {
|
|
|
|
+ NoClassDefFoundError loadException = null;
|
|
|
|
+ SkyblockAPIHook skyblockAPI = null;
|
|
|
|
+
|
|
for(HookInfo hookInfo : HookInfo.values()) {
|
|
for(HookInfo hookInfo : HookInfo.values()) {
|
|
String pluginName = hookInfo.name().replace("Legacy", "");
|
|
String pluginName = hookInfo.name().replace("Legacy", "");
|
|
if(Bukkit.getServer().getPluginManager().isPluginEnabled(pluginName)) {
|
|
if(Bukkit.getServer().getPluginManager().isPluginEnabled(pluginName)) {
|
|
try {
|
|
try {
|
|
- skyblockAPI = (SkyblockAPIHook) hookInfo.getHookClass().newInstance();
|
|
|
|
|
|
+ try {
|
|
|
|
+ skyblockAPI = (SkyblockAPIHook) hookInfo.getHookClass().newInstance();
|
|
|
|
+ }catch(NoClassDefFoundError e) {
|
|
|
|
+ loadException = e;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
sendConsole(String.format("&aUsing %s as SkyBlock-Plugin, hook class: %s", pluginName, hookInfo.getHookClass().getName()));
|
|
sendConsole(String.format("&aUsing %s as SkyBlock-Plugin, hook class: %s", pluginName, hookInfo.getHookClass().getName()));
|
|
break;
|
|
break;
|
|
- } catch (Exception e) {
|
|
|
|
- // TODO Auto-generated catch block
|
|
|
|
- loadException = e;
|
|
|
|
|
|
+ } catch (InstantiationException | IllegalAccessException e) {
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -146,7 +157,7 @@ public class CustomOreGen extends JavaPlugin {
|
|
skyblockAPI = new HookVanilla();
|
|
skyblockAPI = new HookVanilla();
|
|
}
|
|
}
|
|
|
|
|
|
- skyblockAPICached = new SkyblockAPICached(skyblockAPI);
|
|
|
|
|
|
+ return skyblockAPI;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|