From ee9f9d40ceaebaeec9c97f310955d2ede28761fa Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 5 May 2021 09:58:08 +0200 Subject: [PATCH] Optimize SWCommand --- SpigotCore_Main/src/de/steamwar/command/SWCommand.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java index 5e73a02..20f1d5c 100644 --- a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java +++ b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java @@ -60,13 +60,14 @@ public abstract class SWCommand { @Override public List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { + String string = args[args.length - 1].toLowerCase(); return commandList.stream() .map(s -> s.tabComplete(sender, args)) .filter(Objects::nonNull) .flatMap(Collection::stream) .filter(s -> !s.isEmpty()) .filter(s -> !s.isBlank()) - .filter(s -> s.toLowerCase().startsWith(args[args.length - 1].toLowerCase())) + .filter(s -> s.toLowerCase().startsWith(string)) .collect(Collectors.toList()); } };