Skip to content

Commit

Permalink
fix tabcomplete suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Jan 1, 2025
1 parent 87641b1 commit 4cf5f0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand All @@ -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();
Expand Down

0 comments on commit 4cf5f0a

Please sign in to comment.