This commit is contained in:
坏黑 2019-10-26 01:24:03 +08:00
parent f04fcaa2b3
commit e5f812d94c

View File

@ -41,35 +41,32 @@ public class TScheduleLoader implements TabooLibLoader.Loader {
if (annotation == null) { if (annotation == null) {
continue; continue;
} }
method.setAccessible(true);
if (plugin.equals(TabooLib.getPlugin())) { if (plugin.equals(TabooLib.getPlugin())) {
run(plugin, new BukkitRunnable() { method.setAccessible(true);
TInjectHelper.getInstance(method, pluginClass, plugin).forEach(instance -> run(plugin, new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
for (Object i : TInjectHelper.getInstance(method, pluginClass, plugin)) {
try { try {
method.invoke(i); method.invoke(instance);
} catch (Throwable t) { } catch (Throwable t) {
t.printStackTrace(); t.printStackTrace();
} }
} }
} }, annotation.delay(), annotation.period(), annotation.async()));
}, annotation.delay(), annotation.period(), annotation.async());
} else { } else {
schedules.computeIfAbsent(plugin.getName(), n -> Lists.newArrayList()).add(new TScheduleData(annotation, new BukkitRunnable() { method.setAccessible(true);
TInjectHelper.getInstance(method, pluginClass, plugin).forEach(instance -> schedules.computeIfAbsent(plugin.getName(), n -> Lists.newArrayList()).add(new TScheduleData(annotation, new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
for (Object i : TInjectHelper.getInstance(method, pluginClass, plugin)) {
try { try {
method.invoke(i); method.invoke(instance);
} catch (Throwable t) { } catch (Throwable t) {
t.printStackTrace(); t.printStackTrace();
} }
} }
} })));
}));
} }
} }
} }