fix: sponge task & command error

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2020-11-20 14:22:28 +08:00
parent 894d5d43e6
commit 611d4e5425
2 changed files with 3 additions and 5 deletions

View File

@@ -20,8 +20,7 @@ export class SpongeTaskManager extends task.TaskManager {
return new SpongeTask(owner, func, id)
}
callSyncMethod(func: Function): any {
// @ts-ignore
return this.syncExecutor.schedule(new Callable({ call: () => func() }), java.lang.Long.valueOf(0), TimeUnit.NANOSECONDS).get()
return this.syncExecutor.execute(() => func())
}
disable0() {
Sponge.getScheduler().getScheduledTasks(base.getInstance()).forEach((task: task.Cancelable) => task.cancel())