@@ -6,17 +6,14 @@ let TimeUnit = Java.type('java.util.concurrent.TimeUnit')
 | 
			
		||||
 | 
			
		||||
@provideSingleton(task.TaskManager)
 | 
			
		||||
export class BungeeTaskManager extends task.TaskManager {
 | 
			
		||||
    @inject(plugin.PluginInstance)
 | 
			
		||||
    private pluginInstance: any
 | 
			
		||||
 | 
			
		||||
    create0(func: Function): task.Task {
 | 
			
		||||
        return new BungeeTask(this.pluginInstance, func)
 | 
			
		||||
    create0(owner: plugin.Plugin, func: Function, id: number): task.Task {
 | 
			
		||||
        return new BungeeTask(owner, func, id)
 | 
			
		||||
    }
 | 
			
		||||
    callSyncMethod(func: Function): any {
 | 
			
		||||
        return func()
 | 
			
		||||
    }
 | 
			
		||||
    disable0() {
 | 
			
		||||
        this.pluginInstance.getProxy().getScheduler().cancel(this.pluginInstance)
 | 
			
		||||
        base.getInstance().getProxy().getScheduler().cancel(base.getInstance())
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -24,12 +21,12 @@ export class BungeeTask extends task.Task {
 | 
			
		||||
    submit0(...args: any[]): task.Cancelable {
 | 
			
		||||
        let run = new Runnable({ run: () => this.run(...args) })
 | 
			
		||||
        if (this.isAsync) {
 | 
			
		||||
            return this.plugin.getProxy().getScheduler().runAsync(this.plugin, run)
 | 
			
		||||
            return base.getInstance().getProxy().getScheduler().runAsync(base.getInstance(), run)
 | 
			
		||||
        }
 | 
			
		||||
        if (this.interval) {
 | 
			
		||||
            return this.plugin.getProxy().getScheduler().schedule(this.plugin, run, this.laterTime * 50, this.interval * 50, TimeUnit.MILLISECONDS)
 | 
			
		||||
            return base.getInstance().getProxy().getScheduler().schedule(base.getInstance(), run, this.laterTime * 50, this.interval * 50, TimeUnit.MILLISECONDS)
 | 
			
		||||
        } else {
 | 
			
		||||
            return this.plugin.getProxy().getScheduler().schedule(this.plugin, run, this.laterTime * 50, TimeUnit.MILLISECONDS)
 | 
			
		||||
            return base.getInstance().getProxy().getScheduler().schedule(base.getInstance(), run, this.laterTime * 50, TimeUnit.MILLISECONDS)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user