2020-05-26 07:53:41 +00:00
|
|
|
import { server } from '@ccms/api'
|
2020-06-02 09:50:47 +00:00
|
|
|
import { provideSingleton, inject } from '@ccms/container'
|
|
|
|
import { NativePluginManager } from '@ccms/api/dist/interfaces/server/native_plugin'
|
|
|
|
import { CommandMap } from './internal/command'
|
2020-05-26 07:53:41 +00:00
|
|
|
|
|
|
|
@provideSingleton(server.Server)
|
|
|
|
export class SpringServer implements server.Server {
|
2020-06-02 09:50:47 +00:00
|
|
|
@inject(CommandMap)
|
|
|
|
private commandMap: CommandMap
|
|
|
|
|
2020-05-26 07:53:41 +00:00
|
|
|
constructor() {
|
|
|
|
}
|
|
|
|
getVersion(): string {
|
|
|
|
return "SpringFramework"
|
|
|
|
}
|
|
|
|
getPlayer(name: string) {
|
2020-06-02 09:50:47 +00:00
|
|
|
throw new Error("Method not implemented.")
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
getOnlinePlayers(): any[] {
|
2020-06-02 09:50:47 +00:00
|
|
|
throw new Error("Method not implemented.")
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
getConsoleSender() {
|
2020-06-02 09:50:47 +00:00
|
|
|
return {
|
2020-06-20 08:39:03 +00:00
|
|
|
name: 'CONSOLE',
|
2020-06-02 09:50:47 +00:00
|
|
|
sendMessage: (message: string) => console.console(message)
|
|
|
|
}
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
getService(service: string) {
|
2020-06-02 09:50:47 +00:00
|
|
|
throw new Error("Method not implemented.")
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
dispatchCommand(sender: any, command: string): boolean {
|
2020-06-02 09:50:47 +00:00
|
|
|
let cmd_args = command.split(" ")
|
|
|
|
return this.commandMap.dispatch(sender, cmd_args.shift(), cmd_args || [])
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
dispatchConsoleCommand(command: string): boolean {
|
2020-06-02 09:50:47 +00:00
|
|
|
return this.dispatchCommand(this.getConsoleSender(), command)
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
getPluginsFolder(): string {
|
2020-06-02 09:50:47 +00:00
|
|
|
throw new Error("Method not implemented.")
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
getNativePluginManager(): NativePluginManager {
|
2020-06-02 09:50:47 +00:00
|
|
|
throw new Error("Method not implemented.")
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
getNettyPipeline() {
|
|
|
|
return base.getInstance().getAutowireCapableBeanFactory()
|
|
|
|
}
|
|
|
|
getRootLogger() {
|
2020-06-02 09:50:47 +00:00
|
|
|
return Packages.org.slf4j.LoggerFactory.getLogger("root") || global.logger
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
sendJson(sender: any, json: string | object): void {
|
2020-06-02 09:50:47 +00:00
|
|
|
throw new Error("Method not implemented.")
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
tabComplete(sender: any, input: string, index?: number) {
|
2020-06-20 08:39:03 +00:00
|
|
|
return this.commandMap.tabComplate(sender, input, index)
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
}
|