feat: complate command event and task

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-09-21 15:04:47 +08:00
parent bf5628a646
commit c4c2c0ab0f
6 changed files with 166 additions and 5 deletions

View File

@@ -1,13 +1,22 @@
import { server, plugin } from '@ms/api'
import './typings'
import { server, plugin, command, event, task } from '@ms/api'
import { DefaultContainer as container } from '@ms/container'
import { SpongeConsole } from './console'
import { SpongeConsole } from './console';
import { SpongeEvent } from './event';
import { SpongeCommand } from './command';
import { SpongeTaskManager } from './task';
let SpongeServerType = 'sponge';
let Sponge = Java.type("org.spongepowered.api.Sponge");
console.debug(`Detect Sponge Compatible set ServerType to ${SpongeServerType} ...`)
container.bind(server.Console).toConstantValue(SpongeConsole);
container.bind(server.ServerType).toConstantValue(SpongeServerType);
container.bind(plugin.PluginInstance).toConstantValue(Sponge.pluginManager.getPlugin('MiaoScript').orElse(null));
container.bind(event.Event).to(SpongeEvent).inSingletonScope();
container.bind(command.Command).to(SpongeCommand).inSingletonScope();
container.bind(task.TaskManager).to(SpongeTaskManager).inSingletonScope();
console.debug(`Detect Sponge Compatible set ServerType to ${SpongeServerType} ...`)