From 1845cec507a13e49c247d4f37087c691cb49cd66 Mon Sep 17 00:00:00 2001 From: EpicPlayerA10 <62206933+EpicPlayerA10@users.noreply.github.com> Date: Tue, 13 Dec 2022 13:24:59 +0100 Subject: [PATCH] Fix death message containing empty string (#8656) Resolves: #8654 --- patches/api/0005-Adventure.patch | 6 +++--- patches/api/0178-PlayerDeathEvent-getItemsToKeep.patch | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/patches/api/0005-Adventure.patch b/patches/api/0005-Adventure.patch index c9f70de08f..2ab8f14aae 100644 --- a/patches/api/0005-Adventure.patch +++ b/patches/api/0005-Adventure.patch @@ -2576,7 +2576,7 @@ index 7190db11eff7d48df8a99f405a9dbaefdfa76e3d..1268066e30ddb0cd3792ea4b3de894eb @Override diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..7941c60b0e1840785ba2b250071591bd75bc6e35 100644 +index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..1f1df82c9bcf18bad1187e3f24ede1901d91c06f 100644 --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java @@ -12,25 +12,48 @@ import org.jetbrains.annotations.Nullable; @@ -2624,7 +2624,7 @@ index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..7941c60b0e1840785ba2b250071591bd this.newTotalExp = newTotalExp; this.newLevel = newLevel; this.deathMessage = deathMessage; -+ this.adventure$deathMessage = deathMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper ++ this.adventure$deathMessage = deathMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(deathMessage) : null; // Paper } @NotNull @@ -2662,7 +2662,7 @@ index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..7941c60b0e1840785ba2b250071591bd + @Deprecated // Paper public void setDeathMessage(@Nullable String deathMessage) { this.deathMessage = deathMessage; -+ this.adventure$deathMessage = deathMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper ++ this.adventure$deathMessage = deathMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(deathMessage) : null; // Paper } /** diff --git a/patches/api/0178-PlayerDeathEvent-getItemsToKeep.patch b/patches/api/0178-PlayerDeathEvent-getItemsToKeep.patch index 871984a4fc..613dd778e6 100644 --- a/patches/api/0178-PlayerDeathEvent-getItemsToKeep.patch +++ b/patches/api/0178-PlayerDeathEvent-getItemsToKeep.patch @@ -8,7 +8,7 @@ Exposes a mutable array on items a player should keep on death Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4 diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -index a871eddf73f918c0e3d2554ef8d9cfd0f830fcaa..5f7d0d08be8bca06c9aa89659b7865a7b5a547f8 100644 +index 3b43954b428f2e5e9a718bf6d34116f25c90269f..bfd3654c02e8ad906c620a86165a38c65a31b62b 100644 --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java @@ -36,7 +36,6 @@ public class PlayerDeathEvent extends EntityDeathEvent { @@ -20,7 +20,7 @@ index a871eddf73f918c0e3d2554ef8d9cfd0f830fcaa..5f7d0d08be8bca06c9aa89659b7865a7 this(player, drops, droppedExp, 0, deathMessage); } @@ -56,6 +55,41 @@ public class PlayerDeathEvent extends EntityDeathEvent { - this.adventure$deathMessage = deathMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper + this.adventure$deathMessage = deathMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(deathMessage) : null; // Paper } + @Deprecated // Paper