feat: complate database & web

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2020-06-20 16:39:03 +08:00
parent 842335edbe
commit bf3638dda0
15 changed files with 201 additions and 56 deletions

View File

@@ -34,12 +34,32 @@ export class CommandMap {
}
let exists = this.commands[command]
if (exists) {
return exists.executor(sender, '', command, Java.to(args))
try {
return exists.executor(sender, '', command, Java.to(args))
} catch (error) {
console.ex(error)
}
return true
} else {
sender.sendMessage && sender.sendMessage(`Unknown command. Type "/help" for help.`)
return false
}
}
tabComplate(sender: any, input: string, index?: number): string[] {
if (index == 0) { return Object.keys(this.commands) }
let [command, ...args] = input.split(' ')
let exists = this.commands[command]
if (exists && exists.tabCompleter) {
try {
if (args.length !== index) { args.push('') }
return exists.tabCompleter(sender, '', command, Java.to(args))
} catch (error) {
console.ex(error)
}
}
return []
}
}
export class SpringCommand {