mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-24 22:26:45 +01:00
Prevent vanished players from being in plot kick autocompletion (#4485)
This commit is contained in:
parent
a69cd609b9
commit
e1ccda3e6d
@ -153,7 +153,7 @@ public class Kick extends SubCommand {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
return TabCompletions.completePlayersInPlot(plot, String.join(",", args).trim(),
|
return TabCompletions.completePlayersInPlot(player, plot, String.join(",", args).trim(),
|
||||||
Collections.singletonList(player.getName())
|
Collections.singletonList(player.getName())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,7 @@ public final class TabCompletions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static @NonNull List<Command> completePlayersInPlot(
|
public static @NonNull List<Command> completePlayersInPlot(
|
||||||
|
final @NonNull PlotPlayer<?> issuer,
|
||||||
final @NonNull Plot plot,
|
final @NonNull Plot plot,
|
||||||
final @NonNull String input, final @NonNull List<String> existing
|
final @NonNull String input, final @NonNull List<String> existing
|
||||||
) {
|
) {
|
||||||
@ -115,7 +116,9 @@ public final class TabCompletions {
|
|||||||
final List<PlotPlayer<?>> inPlot = plot.getPlayersInPlot();
|
final List<PlotPlayer<?>> inPlot = plot.getPlayersInPlot();
|
||||||
players = new ArrayList<>(inPlot.size());
|
players = new ArrayList<>(inPlot.size());
|
||||||
for (PlotPlayer<?> player : inPlot) {
|
for (PlotPlayer<?> player : inPlot) {
|
||||||
players.add(player.getName());
|
if (issuer.canSee(player)) {
|
||||||
|
players.add(player.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cachedCompletionValues.put("inPlot" + plot, players);
|
cachedCompletionValues.put("inPlot" + plot, players);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user