Buff callbacks run in a separate schedule

This commit is contained in:
Treeku
2013-12-11 12:31:51 +00:00
parent 82a7bbaa9a
commit 62167880ac
+12 -5
View File
@@ -136,11 +136,18 @@ public class BuffService implements INetworkDispatch {
if (!buff.getCallback().equals("")) {
if (FileUtilities.doesFileExist("scripts/buffs/" + buff.getBuffName() + ".py")) {
PyObject method = core.scriptService.getMethod("scripts/buffs/", buff.getBuffName(), buff.getCallback());
if (method != null && method.isCallable()) {
method.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(buff));
}
scheduler.schedule(new Runnable() {
@Override
public void run() {
PyObject method = core.scriptService.getMethod("scripts/buffs/", buff.getBuffName(), buff.getCallback());
if (method != null && method.isCallable()) {
method.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(buff));
}
}
}, 0, TimeUnit.SECONDS);
}
}