From d16b9b1138218f58d01c87c1ad7d8ab6e76c09c6 Mon Sep 17 00:00:00 2001 From: Kenneth Endfinger Date: Sun, 16 Jan 2022 20:37:19 -0500 Subject: [PATCH] Bifrost: Fix player death messages. --- .../foundation/bifrost/FoundationBifrostPlugin.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/foundation-bifrost/src/main/kotlin/cloud/kubelet/foundation/bifrost/FoundationBifrostPlugin.kt b/foundation-bifrost/src/main/kotlin/cloud/kubelet/foundation/bifrost/FoundationBifrostPlugin.kt index 4cf2e32..191777b 100644 --- a/foundation-bifrost/src/main/kotlin/cloud/kubelet/foundation/bifrost/FoundationBifrostPlugin.kt +++ b/foundation-bifrost/src/main/kotlin/cloud/kubelet/foundation/bifrost/FoundationBifrostPlugin.kt @@ -154,13 +154,12 @@ class FoundationBifrostPlugin : JavaPlugin(), DiscordEventListener, BukkitEventL @EventHandler(priority = EventPriority.MONITOR) private fun onPlayerDeath(e: PlayerDeathEvent) { if (!config.channel.sendPlayerDeath) return - val deathMessage = e.deathMessage() - val message = if (deathMessage != null) { - LegacyComponentSerializer.legacySection().serialize(deathMessage) - } else { - "died" + @Suppress("DEPRECATION") + var deathMessage = e.deathMessage + if (deathMessage == null || deathMessage.isBlank()) { + deathMessage = "${e.player.name} died" } - sendEmbedMessage(Color.YELLOW, "${e.player.name} $message") + sendEmbedMessage(Color.YELLOW, deathMessage) } private fun onDiscordReady() {