SteamWar/MissileWars
Archiviert
13
0

Fix CommandInvite TabCompleter #26

Manuell gemergt
YoyoNow hat 1 Commits von TabCompleter nach master 2020-12-22 16:41:50 +01:00 zusammengeführt

Datei anzeigen

@ -81,7 +81,7 @@ public class CommandInvite implements CommandExecutor, TabCompleter {
@Override @Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) { public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
if (args.length == 0) { if (args.length == 1) {
return Bukkit.getOnlinePlayers() return Bukkit.getOnlinePlayers()
.stream() .stream()
.filter(p -> MissileWars.getTeam(p) != null) .filter(p -> MissileWars.getTeam(p) != null)
@ -89,16 +89,7 @@ public class CommandInvite implements CommandExecutor, TabCompleter {
.map(Player::getName) .map(Player::getName)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
if (args.length != 1) { return new ArrayList<>();
return new ArrayList<>();
}
return Bukkit.getOnlinePlayers()
.stream()
.filter(p -> MissileWars.getTeam(p) != null)
.filter(p -> MissileWars.getInvitation(p) != null)
.map(Player::getName)
.filter(s -> s.startsWith(args[0]))
.collect(Collectors.toList());
} }
} }