Skip to content

Commit 80d18b8

Browse files
committed
update death and kill watch embeds
1 parent 178e65e commit 80d18b8

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/main/java/vc/live/watch/WatchManager.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -364,36 +364,45 @@ public EmbedCreateSpec deathsWatchEmbed(
364364
final DeathsRecord death
365365
) {
366366
var profile = new ProfileDataImpl(death.victimPlayerName(), death.victimPlayerUuid());
367-
EmbedCreateSpec embed = EmbedCreateSpec.builder()
367+
var embed = EmbedCreateSpec.builder()
368368
.title("Watched Player Death")
369369
.addField("Victim", "[" + profile.name() + "](" + profile.getNameMCLink(profile.uuid()) + ")", true)
370370
.addField("\u200B", "\u200B", true)
371-
.addField("\u200B", "\u200B", true)
372-
.addField("Death Message", death.deathMessage(), false)
371+
.addField("\u200B", "\u200B", true);
372+
if (death.killerPlayerUuid() != null) {
373+
var killerProfile = new ProfileDataImpl(death.killerPlayerName(), death.killerPlayerUuid());
374+
embed
375+
.addField("Killer", "[" + killerProfile.name() + "](" + killerProfile.getNameMCLink(killerProfile.uuid()) + ")", true)
376+
.addField("\u200B", "\u200B", true)
377+
.addField("\u200B", "\u200B", true);
378+
}
379+
embed
380+
.addField("Death Message", escape(death.deathMessage().replace(death.victimPlayerName(), "**" + death.victimPlayerName() + "**")), false)
373381
.thumbnail(profile.getAvatarURL())
374382
.timestamp(death.time().toInstant())
375383
.color(Color.RUBY)
376384
.build();
377-
return embed;
385+
return embed.build();
378386
}
379387

380388
public EmbedCreateSpec killsWatchEmbed(
381389
final DeathsRecord death
382390
) {
383391
var killerProfile = new ProfileDataImpl(death.killerPlayerName(), death.killerPlayerUuid());
384392
var victimProfile = new ProfileDataImpl(death.victimPlayerName(), death.victimPlayerUuid());
385-
EmbedCreateSpec embed = EmbedCreateSpec.builder()
393+
return EmbedCreateSpec.builder()
386394
.title("Watched Player Kill")
387395
.addField("Killer", "[" + killerProfile.name() + "](" + killerProfile.getNameMCLink(killerProfile.uuid()) + ")", true)
388396
.addField("\u200B", "\u200B", true)
389397
.addField("\u200B", "\u200B", true)
390-
.addField("Victim", "[" + victimProfile.name() + "](" + victimProfile.getNameMCLink(victimProfile.uuid()) + ")", false)
391-
.addField("Death Message", death.deathMessage(), false)
398+
.addField("Victim", "[" + victimProfile.name() + "](" + victimProfile.getNameMCLink(victimProfile.uuid()) + ")", true)
399+
.addField("\u200B", "\u200B", true)
400+
.addField("\u200B", "\u200B", true)
401+
.addField("Death Message", escape(death.deathMessage().replace(killerProfile.name(), "**" + killerProfile.name() + "**")), false)
392402
.thumbnail(killerProfile.getAvatarURL())
393403
.timestamp(death.time().toInstant())
394404
.color(Color.SEA_GREEN)
395405
.build();
396-
return embed;
397406
}
398407

399408
private void connectionsTopicListener(final String msg) {

0 commit comments

Comments
 (0)