From 4e02f61903bfedc512c5bd89a740e6afc6794e09 Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Sun, 3 Mar 2024 16:46:56 +0500 Subject: [PATCH] fix: correctly determine when to send death message instead of knockdown message --- .../knockdowns/common/events/KnockdownsEvents.java | 8 +++++--- gradle.properties | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/ru/octol1ttle/knockdowns/common/events/KnockdownsEvents.java b/common/src/main/java/ru/octol1ttle/knockdowns/common/events/KnockdownsEvents.java index 8f46b96..16a3e78 100644 --- a/common/src/main/java/ru/octol1ttle/knockdowns/common/events/KnockdownsEvents.java +++ b/common/src/main/java/ru/octol1ttle/knockdowns/common/events/KnockdownsEvents.java @@ -70,10 +70,12 @@ public class KnockdownsEvents { KnockdownsNetwork.sendToWorld(player.getServerWorld(), new PlayKnockedDownSoundS2CPacket(player.getX(), player.getY(), player.getZ())); Text deathMessage = entity.getDamageTracker().getDeathMessage(); - TranslatableTextContent content = (TranslatableTextContent) deathMessage.getContent(); - Text replaced = Text.translatableWithFallback(content.getKey().replace("death.", "knockdown."), deathMessage.getString(), content.getArgs()); + TranslatableTextContent deathContent = (TranslatableTextContent) deathMessage.getContent(); - server.getPlayerManager().broadcast(replaced, false); + String knockdownKey = deathContent.getKey().replace("death.", "knockdown."); + Text knockdownMessage = Text.translatable(knockdownKey, deathContent.getArgs()); + + server.getPlayerManager().broadcast(!knockdownMessage.getString().equals(knockdownKey) ? knockdownMessage : deathMessage, false); return EventResult.interruptFalse(); }); diff --git a/gradle.properties b/gradle.properties index f07c82c..df19e26 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ minecraft_version=1.20.1 enabled_platforms=fabric,forge archives_base_name=knockdowns -mod_version=2.1.0 +mod_version=2.1.1 maven_group=ru.octol1ttle.knockdowns architectury_version=9.1.12