From 0296716a4e847c7cc30616cb6d0ff468d3d62bf8 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 24 Sep 2022 11:15:40 +0200 Subject: [PATCH] Hotfix TypeMappers --- CommonCore | 2 +- .../bungeecore/commands/TypeMappers.java | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CommonCore b/CommonCore index 1dea719..a249d66 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 1dea71993d897354d3f52a705f6e0e1e0c8ec580 +Subproject commit a249d66dcf96bb9aef44b700438c81670ad81de7 diff --git a/src/de/steamwar/bungeecore/commands/TypeMappers.java b/src/de/steamwar/bungeecore/commands/TypeMappers.java index faedfba..8db94be 100644 --- a/src/de/steamwar/bungeecore/commands/TypeMappers.java +++ b/src/de/steamwar/bungeecore/commands/TypeMappers.java @@ -33,6 +33,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.stream.Collectors; @UtilityClass public class TypeMappers { @@ -66,15 +67,19 @@ public class TypeMappers { return ArenaMode.getByChat(s); } - @Override - public boolean validate(CommandSender sender, ArenaMode value, MessageSender messageSender) { - if (value == null) return true; - return value.isHistoric() == historic; - } - @Override public Collection tabCompletes(CommandSender sender, String[] previousArguments, String s) { - return ArenaMode.getAllChatNames(historic); + if (!historic) { + List toReturn = ArenaMode.getAllChatNames(false).stream() + .map(String::toLowerCase) + .filter(s1 -> s1.startsWith(s.toLowerCase())) + .collect(Collectors.toList()); + if (toReturn.isEmpty()) { + return ArenaMode.getAllChatNames(true); + } + return toReturn; + } + return ArenaMode.getAllChatNames(true); } }; }