From e731de2162905c7320430b7e1cefae7e1f81a79a Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Wed, 23 Sep 2020 11:25:53 +0800 Subject: [PATCH] fix: bungee task error --- packages/bungee/src/task.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/bungee/src/task.ts b/packages/bungee/src/task.ts index e00bf7b1..8e546814 100644 --- a/packages/bungee/src/task.ts +++ b/packages/bungee/src/task.ts @@ -9,17 +9,13 @@ export class BungeeTaskManager extends task.TaskManager { @inject(plugin.PluginInstance) private pluginInstance: any - create(func: Function, plugin?: plugin.Plugin): task.Task { - if (Object.prototype.toString.call(func) !== "[object Function]") { throw TypeError('第一个参数 Task 必须为 function !') }; - let task = new BungeeTask(this.pluginInstance, func) - if (plugin) { return this.pluginCreate(plugin, task) } - return task + create0(func: Function): task.Task { + return new BungeeTask(this.pluginInstance, func) } callSyncMethod(func: Function): any { return func() } - disable(plugin?: plugin.Plugin) { - if (plugin) { return this.pluginDisable(plugin) } + disable0() { this.pluginInstance.getProxy().getScheduler().cancel(this.pluginInstance) } }