From 9e4dbcdbb856ef0c08cfc638496d49fd0a6904b3 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 30 Jul 2021 13:50:47 +0200 Subject: [PATCH] Add TeamCommand Online type --- src/de/steamwar/bungeecore/bot/commands/TeamCommand.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/bot/commands/TeamCommand.java b/src/de/steamwar/bungeecore/bot/commands/TeamCommand.java index 2374bd1..3af2947 100644 --- a/src/de/steamwar/bungeecore/bot/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/bot/commands/TeamCommand.java @@ -28,8 +28,10 @@ import net.dv8tion.jda.api.events.interaction.SlashCommandEvent; import net.dv8tion.jda.api.interactions.commands.OptionMapping; import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.build.SubcommandData; +import net.md_5.bungee.api.ProxyServer; import java.awt.*; +import java.util.List; import java.util.stream.Collectors; public class TeamCommand extends BasicDiscordCommand { @@ -71,8 +73,11 @@ public class TeamCommand extends BasicDiscordCommand { EmbedBuilder embedBuilder = new EmbedBuilder(); embedBuilder.setTitle("Team: " + team.getTeamName() + " [" + team.getTeamKuerzel() + "]"); embedBuilder.setColor(Color.GRAY); - embedBuilder.addField("Leader", "`" + team.getMembers().stream().map(SteamwarUser::get).filter(SteamwarUser::isLeader).map(SteamwarUser::getUserName).collect(Collectors.joining("` `")) + "`", false); - embedBuilder.addField("Member", "`" + team.getMembers().stream().map(SteamwarUser::get).filter(user -> !user.isLeader()).map(SteamwarUser::getUserName).collect(Collectors.joining("` `")) + "`", false); + List members = team.getMembers().stream().map(SteamwarUser::get).collect(Collectors.toList()); + + embedBuilder.addField("Leader", "`" + members.stream().filter(SteamwarUser::isLeader).map(SteamwarUser::getUserName).collect(Collectors.joining("` `")) + "`", false); + embedBuilder.addField("Member", "`" + members.stream().filter(user -> !user.isLeader()).map(SteamwarUser::getUserName).collect(Collectors.joining("` `")) + "`", false); + embedBuilder.addField("Online", "`" + members.stream().filter(user -> ProxyServer.getInstance().getPlayer(user.getUuid()) != null).map(SteamwarUser::getUserName).collect(Collectors.joining("` `")) + "`", false); embedBuilder.addField("Events", "`" + TeamTeilnahme.getEvents(team.getTeamId()).stream().map(Event::getEventName).collect(Collectors.joining("` `")) + "`", false); event.replyEmbeds(embedBuilder.build()).setEphemeral(true).complete(); return;