Skip to content

Commit

Permalink
Make sure tab complete list is mutable in transfer command
Browse files Browse the repository at this point in the history
  • Loading branch information
md5sha256 committed Nov 13, 2023
1 parent 1db23d4 commit 67dad42
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.function.Predicate;
import java.util.stream.Collectors;

@Singleton
Expand Down Expand Up @@ -121,9 +122,9 @@ private void handlePlayer(Player player, String[] args) {
public List<String> getTabCompleteList(int toComplete, String[] start, CommandSender sender) {
if (toComplete == 2) {
Collection<? extends Player> players = this.server.getOnlinePlayers();
List<String> ret = players.stream()
List<String> ret = new ArrayList<>(players.stream()
.map(Player::getName)
.collect(Collectors.toCollection(ArrayList::new));
.toList());
if (sender instanceof Player player) {
ret.remove(player.getName());
}
Expand Down

0 comments on commit 67dad42

Please sign in to comment.