Skip to content

Commit

Permalink
fix: /tp TAB not serving players in arg 0, close #675
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Aug 22, 2024
1 parent 3b7bb27 commit 7029b50
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ private void execute(@NotNull CommandUser executor, @NotNull Teleportable telepo
public final List<String> suggest(@NotNull CommandUser user, @NotNull String[] args) {
final Position relative = getBasePosition(user);
final boolean serveCoordinateCompletions = user.hasPermission(getPermission("coordinates"));
final boolean servePlayerCompletions = user.hasPermission(getPermission("other"));
switch (args.length) {
case 0, 1 -> {
final ArrayList<String> completions = Lists.newArrayList(serveCoordinateCompletions
Expand All @@ -137,9 +136,7 @@ public final List<String> suggest(@NotNull CommandUser user, @NotNull String[] a
((int) relative.getX() + " " + (int) relative.getY()),
((int) relative.getX() + " " + (int) relative.getY() + " " + (int) relative.getZ()))
: List.of());
if (servePlayerCompletions) {
completions.addAll(plugin.getPlayerList(false));
}
completions.addAll(plugin.getPlayerList(false));
return completions.stream()
.filter(s -> s.toLowerCase().startsWith(args.length == 1 ? args[0].toLowerCase() : ""))
.sorted().collect(Collectors.toList());
Expand All @@ -157,7 +154,7 @@ public final List<String> suggest(@NotNull CommandUser user, @NotNull String[] a
((int) relative.getX() + " " + (int) relative.getY() + " " + (int) relative.getZ()))
: List.of()
);
if (servePlayerCompletions) {
if (user.hasPermission(getPermission("other"))) {
completions.addAll(plugin.getPlayerList(false));
}
}
Expand Down

0 comments on commit 7029b50

Please sign in to comment.