diff --git a/src/main/java/com/ilummc/tlib/TLib.java b/src/main/java/com/ilummc/tlib/TLib.java index 8a5ac8a..f16f01c 100644 --- a/src/main/java/com/ilummc/tlib/TLib.java +++ b/src/main/java/com/ilummc/tlib/TLib.java @@ -22,7 +22,7 @@ public class TLib { @Logger("§8[§3§lTabooLib§8][§r{1}§8] §f{2}") private TLogger tLogger; - private TLibConfig config; + private TLibConfig config = new TLibConfig(); private TConfigWatcher configWatcher = new TConfigWatcher(); @@ -75,5 +75,4 @@ public class TLib { return downloadPoolSize; } } - } diff --git a/src/main/java/com/ilummc/tlib/dependency/TDependency.java b/src/main/java/com/ilummc/tlib/dependency/TDependency.java index e15e975..3987e25 100644 --- a/src/main/java/com/ilummc/tlib/dependency/TDependency.java +++ b/src/main/java/com/ilummc/tlib/dependency/TDependency.java @@ -45,6 +45,7 @@ public class TDependency { try { downloadFinish = downloadMaven(repo, arr[0], arr[1], arr[2], file, url); } catch (Exception ignored) { + ignored.printStackTrace(); } if (downloadFinish) { TDependencyLoader.addToPath(Main.getInst(), file); @@ -63,7 +64,7 @@ public class TDependency { ReentrantLock lock = new ReentrantLock(); AtomicBoolean failed = new AtomicBoolean(false); EagletTask task = new EagletTask() - .url(dl == null ? url + "/" + groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + ".jar" : dl) + .url(dl.length() == 0 ? url + "/" + groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + ".jar" : dl) .file(target) .setThreads(TLib.getTLib().getConfig().getDownloadPoolSize()) .setOnStart(event -> lock.lock()) diff --git a/src/main/java/com/ilummc/tlib/inject/DependencyInjector.java b/src/main/java/com/ilummc/tlib/inject/DependencyInjector.java index dc98f4c..bcf97e8 100644 --- a/src/main/java/com/ilummc/tlib/inject/DependencyInjector.java +++ b/src/main/java/com/ilummc/tlib/inject/DependencyInjector.java @@ -9,16 +9,27 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; import java.io.File; -import java.io.IOException; import java.lang.reflect.Field; public class DependencyInjector { public static void inject(Plugin plugin, Object o) { - injectLogger(plugin, o); - injectPluginInstance(plugin, o); - injectDependencies(plugin, o); - injectConfig(plugin, o); + try { + injectConfig(plugin, o); + } catch (NoClassDefFoundError ignored) { + } + try { + injectLogger(plugin, o); + } catch (NoClassDefFoundError ignored) { + } + try { + injectPluginInstance(plugin, o); + } catch (NoClassDefFoundError ignored) { + } + try { + injectDependencies(plugin, o); + } catch (NoClassDefFoundError ignored) { + } } static void injectOnEnable(Plugin plugin) { @@ -26,11 +37,17 @@ public class DependencyInjector { } static void onDisable(Plugin plugin) { - ejectConfig(plugin, plugin); + try { + ejectConfig(plugin, plugin); + } catch (NoClassDefFoundError ignored) { + } } public static void eject(Plugin plugin, Object o) { - ejectConfig(plugin, o); + try { + ejectConfig(plugin, o); + } catch (NoClassDefFoundError ignored) { + } } private static void ejectConfig(Plugin plugin, Object o) { @@ -79,7 +96,7 @@ public class DependencyInjector { } } } - } catch (IllegalAccessException ignored) { + } catch (Exception ignored) { } } } @@ -95,15 +112,15 @@ public class DependencyInjector { field.setAccessible(true); field.set(o, tLogger); } - } catch (Exception ignored) { - } + } catch (Exception ignored2) { + } } } private static void injectPluginInstance(Plugin plugin, Object o) { - try { - for (Field field : o.getClass().getDeclaredFields()) { - PluginInstance instance; + for (Field field : o.getClass().getDeclaredFields()) { + try { + PluginInstance instance; if ((instance = field.getAnnotation(PluginInstance.class)) != null) { if (!field.isAccessible()) field.setAccessible(true); @@ -120,8 +137,8 @@ public class DependencyInjector { if (pl != null) field.set(o, pl); } - } - } catch (Exception ignored) { + } catch (Exception ignored) { + } } }