From 7bc47a8997b71edff976ab2ee0a32af72567ae9d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 29 Mar 2021 23:06:30 +0200 Subject: [PATCH] Add TypeMapper.tabCompletes with previous TabCompletes --- SpigotCore_Main/src/de/steamwar/command/SWCommandUtils.java | 2 +- SpigotCore_Main/src/de/steamwar/command/SubCommand.java | 4 ++-- SpigotCore_Main/src/de/steamwar/command/TypeMapper.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/command/SWCommandUtils.java b/SpigotCore_Main/src/de/steamwar/command/SWCommandUtils.java index 981b5ca..2ddf34d 100644 --- a/SpigotCore_Main/src/de/steamwar/command/SWCommandUtils.java +++ b/SpigotCore_Main/src/de/steamwar/command/SWCommandUtils.java @@ -138,7 +138,7 @@ public class SWCommandUtils { } @Override - public List tabCompletes(CommandSender commandSender, String s) { + public List tabCompletes(CommandSender commandSender, String[] previous, String s) { return tabCompleter.apply(commandSender, s); } }; diff --git a/SpigotCore_Main/src/de/steamwar/command/SubCommand.java b/SpigotCore_Main/src/de/steamwar/command/SubCommand.java index e0088ec..747e602 100644 --- a/SpigotCore_Main/src/de/steamwar/command/SubCommand.java +++ b/SpigotCore_Main/src/de/steamwar/command/SubCommand.java @@ -112,7 +112,7 @@ class SubCommand { } for (TypeMapper argument : arguments) { String s = argsList.remove(0); - if (argsList.isEmpty()) return argument.tabCompletes(commandSender, s); + if (argsList.isEmpty()) return argument.tabCompletes(commandSender, Arrays.copyOf(args, args.length - 1), s); try { if (argument.map(s) == null) { return Collections.emptyList(); @@ -124,7 +124,7 @@ class SubCommand { if (varArgs && !argsList.isEmpty()) { while (!argsList.isEmpty()) { String s = argsList.remove(0); - if (argsList.isEmpty()) return arguments[arguments.length - 1].tabCompletes(commandSender, s); + if (argsList.isEmpty()) return arguments[arguments.length - 1].tabCompletes(commandSender, Arrays.copyOf(args, args.length - 1), s); try { arguments[arguments.length - 1].map(s); } catch (Exception e) { diff --git a/SpigotCore_Main/src/de/steamwar/command/TypeMapper.java b/SpigotCore_Main/src/de/steamwar/command/TypeMapper.java index f1b5e16..90dbf1e 100644 --- a/SpigotCore_Main/src/de/steamwar/command/TypeMapper.java +++ b/SpigotCore_Main/src/de/steamwar/command/TypeMapper.java @@ -26,5 +26,5 @@ import java.util.List; public interface TypeMapper { T map(String s); - List tabCompletes(CommandSender commandSender, String s); + List tabCompletes(CommandSender commandSender, String[] previousArguments, String s); }