feat: use inversify autoProvide inject

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2020-02-26 10:15:33 +08:00
parent 0ade2b2855
commit 6a5b1598d4
26 changed files with 128 additions and 153 deletions

View File

@ -1,12 +1,12 @@
import '@ms/nashorn'
import { command, plugin } from '@ms/api'
import { injectable, postConstruct, inject } from '@ms/container'
import { inject, provideSingleton, postConstruct } from '@ms/container'
let PluginCommand = Java.type('cn.nukkit.command.PluginCommand');
let CommandExecutor = Java.type('cn.nukkit.command.CommandExecutor');
@injectable()
@provideSingleton(command.Command)
export class NukkitCommand extends command.Command {
@inject(plugin.PluginInstance)
private pluginInstance: any
@ -30,7 +30,6 @@ export class NukkitCommand extends command.Command {
}
}
onCommand(plugin: any, command: any, executor: Function) {
// 必须指定需要实现的接口类型 否则MOD服会报错
command.setExecutor(new CommandExecutor({
onCommand: super.setExecutor(plugin, command, executor)
}));