TabooLib v4.6-R4

+ SQL update.
This commit is contained in:
坏黑
2018-11-03 23:02:20 +08:00
parent 9ae4c0701e
commit 271f1b56b0
4 changed files with 65 additions and 45 deletions

View File

@@ -38,6 +38,7 @@ public class TabooLibLoader implements Listener {
static TabooLibDeprecated tabooLibDeprecated;
static Map<String, List<Class>> pluginClasses = Maps.newHashMap();
static List<Loader> loaders = Lists.newArrayList();
static List<Runnable> tasks = Lists.newArrayList();
static void setup() {
testInternet();
@@ -56,6 +57,15 @@ public class TabooLibLoader implements Listener {
} catch (Exception e) {
e.printStackTrace();
}
Bukkit.getScheduler().runTask(TabooLib.instance(), () -> {
for (Runnable task : tasks) {
try {
task.run();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
static void unregister() {
@@ -80,6 +90,10 @@ public class TabooLibLoader implements Listener {
return classes == null ? new ArrayList<>() : new ArrayList<>(classes);
}
public static void runTaskOnEnabled(Runnable runnable) {
tasks.add(runnable);
}
static boolean isLoader(Class pluginClass) {
return !Loader.class.equals(pluginClass) && Loader.class.isAssignableFrom(pluginClass);
}