Skip to content

Commit

Permalink
Prevent vanished players from being in plot kick autocompletion (#4485)
Browse files Browse the repository at this point in the history
  • Loading branch information
PapiCapi authored Aug 30, 2024
1 parent a69cd60 commit e1ccda3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Core/src/main/java/com/plotsquared/core/command/Kick.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public Collection<Command> tab(final PlotPlayer<?> player, final String[] args,
if (plot == null) {
return Collections.emptyList();
}
return TabCompletions.completePlayersInPlot(plot, String.join(",", args).trim(),
return TabCompletions.completePlayersInPlot(player, plot, String.join(",", args).trim(),
Collections.singletonList(player.getName())
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ private TabCompletions() {
}

public static @NonNull List<Command> completePlayersInPlot(
final @NonNull PlotPlayer<?> issuer,
final @NonNull Plot plot,
final @NonNull String input, final @NonNull List<String> existing
) {
Expand All @@ -115,7 +116,9 @@ private TabCompletions() {
final List<PlotPlayer<?>> inPlot = plot.getPlayersInPlot();
players = new ArrayList<>(inPlot.size());
for (PlotPlayer<?> player : inPlot) {
players.add(player.getName());
if (issuer.canSee(player)) {
players.add(player.getName());
}
}
cachedCompletionValues.put("inPlot" + plot, players);
}
Expand Down

0 comments on commit e1ccda3

Please sign in to comment.