From 4cf5f0abd0e917c2c4b2757ef20491dad6fff388 Mon Sep 17 00:00:00 2001 From: xGinko Date: Wed, 1 Jan 2025 02:48:42 +0100 Subject: [PATCH] fix tabcomplete suggestions --- .../src/main/java/me/xginko/aef/commands/aef/AEFCmd.java | 8 +++++--- .../src/main/java/me/xginko/aef/commands/aef/AEFCmd.java | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/commands/aef/AEFCmd.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/commands/aef/AEFCmd.java index 6e3b8752..724d3b45 100644 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/commands/aef/AEFCmd.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/commands/aef/AEFCmd.java @@ -18,6 +18,8 @@ import java.util.Collections; import java.util.List; +import java.util.Locale; +import java.util.stream.Collectors; import java.util.stream.Stream; public class AEFCmd extends Command implements AEFCommand { @@ -75,7 +77,9 @@ public void enable() { throws CommandException, IllegalArgumentException { if (args.length == 1) { - return tabCompletes; + return tabCompletes.stream() + .filter(cmd -> cmd.toLowerCase(Locale.ROOT).startsWith(args[0].toLowerCase(Locale.ROOT))) + .collect(Collectors.toList()); } if (args.length > 1) { @@ -84,8 +88,6 @@ public void enable() { return subCommand.tabComplete(sender, alias, args); } } - - return tabCompletes.stream().filter(cmd -> cmd.startsWith(args[0])).toList(); } return Collections.emptyList(); diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/commands/aef/AEFCmd.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/commands/aef/AEFCmd.java index 8651e26c..59f026a3 100644 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/commands/aef/AEFCmd.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/commands/aef/AEFCmd.java @@ -20,6 +20,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -80,7 +81,9 @@ public void enable() { throws CommandException, IllegalArgumentException { if (args.length == 1) { - return tabCompletes; + return tabCompletes.stream() + .filter(cmd -> cmd.toLowerCase(Locale.ROOT).startsWith(args[0].toLowerCase(Locale.ROOT))) + .collect(Collectors.toList()); } if (args.length > 1) { @@ -89,8 +92,6 @@ public void enable() { return subCommand.tabComplete(sender, alias, args); } } - - return tabCompletes.stream().filter(cmd -> cmd.startsWith(args[0])).collect(Collectors.toList()); } return Collections.emptyList();