diff --git a/src/de/steamwar/bungeecore/bot/commands/BasicDiscordCommand.java b/src/de/steamwar/bungeecore/bot/commands/BasicDiscordCommand.java index 11506b99..a767ebaa 100644 --- a/src/de/steamwar/bungeecore/bot/commands/BasicDiscordCommand.java +++ b/src/de/steamwar/bungeecore/bot/commands/BasicDiscordCommand.java @@ -37,7 +37,6 @@ public abstract class BasicDiscordCommand extends CommandData { Member member = event.getMember(); SteamwarUser steamwarUser = SteamwarUser.get(member.getIdLong()); if (steamwarUser == null) { - event.reply("Du hast keine Verknüpfung registriert.").setEphemeral(true).complete(); return null; } return steamwarUser; diff --git a/src/de/steamwar/bungeecore/bot/commands/TeamCommand.java b/src/de/steamwar/bungeecore/bot/commands/TeamCommand.java index 3af2947f..53d70397 100644 --- a/src/de/steamwar/bungeecore/bot/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/bot/commands/TeamCommand.java @@ -24,6 +24,7 @@ import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.Team; import de.steamwar.bungeecore.sql.TeamTeilnahme; import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.Emoji; import net.dv8tion.jda.api.events.interaction.SlashCommandEvent; import net.dv8tion.jda.api.interactions.commands.OptionMapping; import net.dv8tion.jda.api.interactions.commands.OptionType; @@ -44,6 +45,8 @@ public class TeamCommand extends BasicDiscordCommand { ); } + private Emoji emoji = Emoji.fromUnicode("U+1F7E2"); + @Override public void run(SlashCommandEvent event) { SteamwarUser steamwarUser = getSteamwarUser(event); @@ -75,9 +78,8 @@ public class TeamCommand extends BasicDiscordCommand { embedBuilder.setColor(Color.GRAY); 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("Leader", members.stream().filter(SteamwarUser::isLeader).map(user -> "`" + (isOnline(user) ? emoji.getAsMention() : "") + user.getUserName() + "`").collect(Collectors.joining(" ")), false); + embedBuilder.addField("Member", members.stream().filter(user -> !user.isLeader()).map(user -> "`" + (isOnline(user) ? emoji.getAsMention() : "") + user.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; @@ -87,4 +89,8 @@ public class TeamCommand extends BasicDiscordCommand { } } } + + private boolean isOnline(SteamwarUser user) { + return ProxyServer.getInstance().getPlayer(user.getUuid()) != null; + } } diff --git a/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java b/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java index 33c98395..626a26e2 100644 --- a/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java +++ b/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java @@ -62,7 +62,7 @@ public class IngameChatListener extends BasicDiscordListener { TextChannel textChannel = SteamwarDiscordBot.instance().getJda().getGuildById(SteamwarDiscordBotConfig.GUILD).getTextChannelById(SteamwarDiscordBotConfig.INGAME_CHANNEL); assert textChannel != null; MessageBuilder messageBuilder = new MessageBuilder(); - messageBuilder.append(message.replace("&", "").replace("@everyone", "`@everyone`").replace("@here", "`@here`")); + messageBuilder.append(message.replace("&", "").replace("@everyone", "`@everyone`").replace("@here", "`@here`").replaceAll("<[@#]!?\\d+>", "`$0`")); textChannel.sendMessage(messageBuilder.build()).complete(); } }