ms/packages/sponge/src/index.ts
MiaoWoo 0491e6fac9 feat: modify import to reference type
Signed-off-by: MiaoWoo <admin@yumc.pw>
2019-09-24 10:12:40 +08:00

23 lines
972 B
TypeScript

/// <reference path="./typings/index.ts" />
import { server, plugin, command, event, task } from '@ms/api'
import { DefaultContainer as container } from '@ms/container'
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");
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} ...`)