refactor: chat & command tabComplete
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
		@@ -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.")
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -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 插件
 | 
			
		||||
 
 | 
			
		||||
@@ -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()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user