diff --git a/pom.xml b/pom.xml
index e2cdbec..38e5229 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.skymc
TabooLib
- 4.13
+ 4.14
UTF-8
diff --git a/src/main/java/com/ilummc/tlib/filter/TLoggerFilter.java b/src/main/java/com/ilummc/tlib/filter/TLoggerFilter.java
index af72083..b53ad30 100644
--- a/src/main/java/com/ilummc/tlib/filter/TLoggerFilter.java
+++ b/src/main/java/com/ilummc/tlib/filter/TLoggerFilter.java
@@ -11,22 +11,23 @@ import java.util.logging.LogRecord;
* @since 2018-04-22
*/
public class TLoggerFilter implements Filter {
-
- public static void init() {
- Bukkit.getLogger().setFilter(new TLoggerFilter());
- }
-
- @Override
- public boolean isLoggable(LogRecord e) {
- if (e.getMessage().contains("Cannot load configuration from stream")) {
- StackTraceElement[] elements = Thread.currentThread().getStackTrace();
- for (StackTraceElement element : elements) {
- if (element.getClassName().contains("ConfigUtils")) {
- System.out.println(Arrays.asList(e.getParameters()));
- }
- }
- return false;
- }
- else return !e.getMessage().contains("Enabled plugin with unregistered PluginClassLoader");
+
+ public static void init() {
+ Bukkit.getLogger().setFilter(new TLoggerFilter());
+ }
+
+ @Override
+ public boolean isLoggable(LogRecord e) {
+ if (e.getMessage().contains("Cannot load configuration from stream")) {
+ StackTraceElement[] elements = Thread.currentThread().getStackTrace();
+ for (StackTraceElement element : elements) {
+ if (element.getClassName().contains("ConfigUtils")) {
+ System.out.println(Arrays.asList(e.getParameters()));
+ }
+ }
+ return false;
+ } else {
+ return !e.getMessage().contains("Enabled plugin with unregistered PluginClassLoader");
+ }
}
}
diff --git a/src/main/java/com/ilummc/tlib/inject/TDependencyInjector.java b/src/main/java/com/ilummc/tlib/inject/TDependencyInjector.java
index d8298a9..534c02f 100644
--- a/src/main/java/com/ilummc/tlib/inject/TDependencyInjector.java
+++ b/src/main/java/com/ilummc/tlib/inject/TDependencyInjector.java
@@ -13,10 +13,17 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.lang.reflect.Field;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
+/**
+ * @author Izzel_Aliz
+ */
public class TDependencyInjector {
+ private static List injected = new ArrayList<>();
+
public static Dependency[] getDependencies(Object o) {
Dependency[] dependencies = new Dependency[0];
Dependencies d = o.getClass().getAnnotation(Dependencies.class);
@@ -30,26 +37,28 @@ public class TDependencyInjector {
return dependencies;
}
- public static void inject(Plugin plugin, Object o) {
- TLocaleLoader.load(plugin, true);
- injectDependencies(plugin, o);
- injectLogger(plugin, o);
- injectConfig(plugin, o);
- injectPluginInstance(plugin, o);
- }
-
static void injectOnEnable(Plugin plugin) {
- if (!plugin.equals(Main.getInst())) {
- inject(plugin, plugin);
- }
+ inject(plugin, plugin);
}
- static void onDisable(Plugin plugin) {
+ static void ejectOnDisable(Plugin plugin) {
eject(plugin, plugin);
}
+ public static void inject(Plugin plugin, Object o) {
+ if (!plugin.equals(Main.getInst()) && !injected.contains(plugin.getName())) {
+ injected.add(plugin.getName());
+ TLocaleLoader.load(plugin, true);
+ injectDependencies(plugin, o);
+ injectLogger(plugin, o);
+ injectConfig(plugin, o);
+ injectPluginInstance(plugin, o);
+ }
+ }
+
public static void eject(Plugin plugin, Object o) {
try {
+ injected.remove(plugin.getName());
ejectConfig(plugin, o);
} catch (Throwable ignored) {
}
diff --git a/src/main/java/com/ilummc/tlib/inject/TPluginManager.java b/src/main/java/com/ilummc/tlib/inject/TPluginManager.java
index f9ead8d..31a5849 100644
--- a/src/main/java/com/ilummc/tlib/inject/TPluginManager.java
+++ b/src/main/java/com/ilummc/tlib/inject/TPluginManager.java
@@ -155,7 +155,7 @@ public class TPluginManager implements PluginManager {
@Override
public void disablePlugin(Plugin plugin) {
- TDependencyInjector.onDisable(plugin);
+ TDependencyInjector.ejectOnDisable(plugin);
instance.disablePlugin(plugin);
}