fix: bungee task error

This commit is contained in:
MiaoWoo 2020-09-23 11:25:53 +08:00
parent b87fb08d1c
commit e731de2162

View File

@ -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)
}
}