ms/packages/sponge/src/index.ts
MiaoWoo 634dbdb16d feat: complate sponge console
Signed-off-by: MiaoWoo <admin@yumc.pw>
2019-09-10 17:21:44 +08:00

14 lines
568 B
TypeScript

import { server, plugin } from '@ms/api'
import { DefaultContainer as container } from '@ms/container'
import { SpongeConsole } from './console'
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));