fix: bungee task error

This commit is contained in:
MiaoWoo 2020-09-23 11:25:53 +08:00
parent 54604e10b8
commit 3389dbd566

View File

@ -9,17 +9,13 @@ export class BungeeTaskManager extends task.TaskManager {
@inject(plugin.PluginInstance) @inject(plugin.PluginInstance)
private pluginInstance: any private pluginInstance: any
create(func: Function, plugin?: plugin.Plugin): task.Task { create0(func: Function): task.Task {
if (Object.prototype.toString.call(func) !== "[object Function]") { throw TypeError('第一个参数 Task 必须为 function !') }; return new BungeeTask(this.pluginInstance, func)
let task = new BungeeTask(this.pluginInstance, func)
if (plugin) { return this.pluginCreate(plugin, task) }
return task
} }
callSyncMethod(func: Function): any { callSyncMethod(func: Function): any {
return func() return func()
} }
disable(plugin?: plugin.Plugin) { disable0() {
if (plugin) { return this.pluginDisable(plugin) }
this.pluginInstance.getProxy().getScheduler().cancel(this.pluginInstance) this.pluginInstance.getProxy().getScheduler().cancel(this.pluginInstance)
} }
} }