From 6766c3b0cedb8b31538aa4125df93abdce419cc8 Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Tue, 26 Feb 2019 09:38:08 +0000 Subject: [PATCH] fix: via command error Signed-off-by: MiaoWoo --- src/main/resources/api/command.js | 3 +-- src/main/resources/internal/bukkit/command.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/resources/api/command.js b/src/main/resources/api/command.js index e9a4187..2b90c40 100644 --- a/src/main/resources/api/command.js +++ b/src/main/resources/api/command.js @@ -2,14 +2,13 @@ function CommandHandlerDefault() { this.on = function(jsp, name, exec) { var cmd = this.create(jsp, { name: name }); + console.debug('插件 %s 创建命令 %s(%s)...'.format(jsp.description.name, name, cmd)) if (exec.cmd && typeof exec.cmd === "function") { - console.debug('插件 %s 设置命令 %s 执行器(%s) ...'.format(jsp.description.name, name, cmd)); this.onCommand(jsp, cmd, exec.cmd) } else { throw Error("CommandExec Must be a function... Input: " + exec.cmd) } if (exec.tab && typeof exec.tab === "function") { - console.debug('插件 %s 设置命令 %s 自动补全(%s) ...'.format(jsp.description.name, name, cmd)); this.onTabComplete(jsp, cmd, exec.tab) } } diff --git a/src/main/resources/internal/bukkit/command.js b/src/main/resources/internal/bukkit/command.js index ceec592..082bc4a 100644 --- a/src/main/resources/internal/bukkit/command.js +++ b/src/main/resources/internal/bukkit/command.js @@ -50,7 +50,7 @@ function disable(jsp) { function create(jsp, command) { var cmd = commandMap.getCommand(command.name) - if (cmd) { return cmd }; + if (cmd && cmd instanceof PluginCommand) { return cmd }; cmd = ref.on(PluginCommand).create(command.name, plugin).get(); commandMap.register(jsp.description.name, cmd); return cmd;