From 2fcb7f1a1d4f9d7c7217b88f26fb81544f4969eb Mon Sep 17 00:00:00 2001 From: coding Date: Tue, 2 Jan 2018 18:00:59 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/internal/sponge/command.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/resources/internal/sponge/command.js b/src/main/resources/internal/sponge/command.js index c5566ee..2497c60 100644 --- a/src/main/resources/internal/sponge/command.js +++ b/src/main/resources/internal/sponge/command.js @@ -31,11 +31,11 @@ var SimpleCommandCallable = function (name) { this.callable = new CommandCallable({ //CommandResult process(CommandSource source, String arguments) throws CommandException; process: function (src, args) { - return that.cmd(src, null, name, args.split(" ")) ? CommandResult.success() : CommandResult.empty(); + return that.cmd(src, name, args.split(" ")) ? CommandResult.success() : CommandResult.empty(); }, //List getSuggestions(CommandSource source, String arguments, @Nullable Location targetPosition) throws CommandException; getSuggestions: function (src, args, target) { - return that.tab(src, null, name, args.split(" ")); + return that.tab(src, name, args.split(" ")); }, //boolean testPermission(CommandSource source); testPermission: function () { @@ -93,7 +93,7 @@ function on(jsp, name, exec) { var c = create(jsp, name); console.debug('插件 %s 设置命令 %s 执行器 ...'.format(jsp.description.name, name)); if (exec.cmd) { - c.setExecutor(function (sender, cmd, command, args) { + c.setExecutor(function (sender, command, args) { try { return exec.cmd(sender, command, args); } catch (ex) { @@ -104,12 +104,10 @@ function on(jsp, name, exec) { }); } if (exec.tab) { - c.setTabCompleter(function (sender, cmd, command, args) { + c.setTabCompleter(function (sender, command, args) { try { - var completions = new ArrayList(); var token = args[args.length - 1]; - StringUtil.copyPartialMatches(token, Arrays.asList(exec.tab(sender, command, args)), completions); - return completions; + return Arrays.asList(exec.tab(sender, command, args)); } catch (ex) { console.console('§6玩家 §a%s §6执行 §b%s §6插件 §d%s %s §6补全时发生异常 §4%s'.format(sender.name, jsp.description.name, command, args, ex)); console.ex(ex);