feat: complate server & update spring

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2020-06-02 17:50:47 +08:00
parent 7e1111470c
commit 16fcbfa69c
9 changed files with 230 additions and 126 deletions

View File

@@ -1,50 +1,55 @@
import { server } from '@ccms/api'
import { provideSingleton } from '@ccms/container';
import { NativePluginManager } from '@ccms/api/dist/interfaces/server/native_plugin';
import { provideSingleton, inject } from '@ccms/container'
import { NativePluginManager } from '@ccms/api/dist/interfaces/server/native_plugin'
import { CommandMap } from './internal/command'
@provideSingleton(server.Server)
export class SpringServer implements server.Server {
@inject(CommandMap)
private commandMap: CommandMap
constructor() {
}
getVersion(): string {
return "SpringFramework"
}
getPlayer(name: string) {
throw new Error("Method not implemented.");
throw new Error("Method not implemented.")
}
getOnlinePlayers(): any[] {
throw new Error("Method not implemented.");
throw new Error("Method not implemented.")
}
getConsoleSender() {
return undefined;
return {
sendMessage: (message: string) => console.console(message)
}
}
getService(service: string) {
throw new Error("Method not implemented.");
throw new Error("Method not implemented.")
}
dispatchCommand(sender: any, command: string): boolean {
console.console('§4Spring暂不支持dispatchCommand!')
return false;
let cmd_args = command.split(" ")
return this.commandMap.dispatch(sender, cmd_args.shift(), cmd_args || [])
}
dispatchConsoleCommand(command: string): boolean {
console.console('§4Spring暂不支持dispatchConsoleCommand!')
return false;
return this.dispatchCommand(this.getConsoleSender(), command)
}
getPluginsFolder(): string {
throw new Error("Method not implemented.");
throw new Error("Method not implemented.")
}
getNativePluginManager(): NativePluginManager {
throw new Error("Method not implemented.");
throw new Error("Method not implemented.")
}
getNettyPipeline() {
return base.getInstance().getAutowireCapableBeanFactory()
}
getRootLogger() {
return global.logger
return Packages.org.slf4j.LoggerFactory.getLogger("root") || global.logger
}
sendJson(sender: any, json: string | object): void {
throw new Error("Method not implemented.");
throw new Error("Method not implemented.")
}
tabComplete(sender: any, input: string, index?: number) {
throw new Error("Method not implemented.");
throw new Error("Method not implemented.")
}
}