refactor: chat & command tabComplete

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2020-09-22 15:29:12 +08:00
parent 68a996f830
commit af85703bd9
10 changed files with 85 additions and 75 deletions

View File

@ -3,6 +3,15 @@ import { injectable } from '@ccms/container'
export namespace chat {
@injectable()
export abstract class Chat {
/**
* sendJsonChat
* @param sender reciver
* @param json json
* @param type chat Type 0: chat 1: system 2: actionBar
*/
sendJson(sender: any, json: string | object, type = 0) {
throw new Error("Method not implemented.")
}
sendMessage(sender: any, message: string) {
throw new Error("Method not implemented.")
}

View File

@ -24,6 +24,9 @@ export namespace command {
this.onTabComplete(plugin, cmd, exec.tab)
}
}
public tabComplete(sender: any, input: string, index?: number): string[] {
throw new Error("Method not implemented.")
}
/**
* 取消命令注册
* @param plugin 插件

View File

@ -4,6 +4,8 @@ import { injectable, inject } from '@ccms/container'
import { NativePluginManager } from './native_plugin'
import { constants } from '../../constants'
export { NativePluginManager } from './native_plugin'
export namespace server {
/**
* Runtime ServerType
@ -13,10 +15,6 @@ export namespace server {
* Runtime Console
*/
export const Console = Symbol("Console")
/**
* MiaoScript Server
*/
export const Server = Symbol("Server")
/**
* Runtime Server Instance
*/
@ -24,21 +22,19 @@ export namespace server {
/**
* MiaoScript Server
*/
export interface Server {
getVersion(): string
getPlayer(name: string): any
getOnlinePlayers(): any[]
getConsoleSender(): any
getService(service: string): any
dispatchCommand(sender: string | any, command: string): boolean
dispatchConsoleCommand(command: string): boolean
getPluginsFolder(): string
getNativePluginManager(): NativePluginManager
getDedicatedServer?(): any
getNettyPipeline(): any
getRootLogger(): any
sendJson(sender: string | any, json: object | string): void
tabComplete?(sender: string | any, input: string, index?: number): string[]
export abstract class Server {
abstract getVersion(): string
abstract getPlayer(name: string): any
abstract getOnlinePlayers(): any[]
abstract getConsoleSender(): any
abstract getService(service: string): any
abstract dispatchCommand(sender: string | any, command: string): boolean
abstract dispatchConsoleCommand(command: string): boolean
abstract getPluginsFolder(): string
abstract getNativePluginManager(): NativePluginManager
abstract getDedicatedServer?(): any
abstract getNettyPipeline(): any
abstract getRootLogger(): any
}
@injectable()
export class ServerChecker {
@ -102,12 +98,6 @@ export namespace server {
getRootLogger() {
throw new Error("Method not implemented.")
}
sendJson(sender: any, json: string | object): void {
throw new Error("Method not implemented.")
}
tabComplete?(sender: any, input: string, index?: number): string[] {
throw new Error("Method not implemented.")
}
protected reflect() {
try {
let consoleServer = this.getDedicatedServer()