From c113e19d41df66d282a8d3180a23d5a43e6bece8 Mon Sep 17 00:00:00 2001 From: EnZaXD <60033407+FlorianMichael@users.noreply.github.com> Date: Thu, 2 May 2024 17:09:27 +0200 Subject: [PATCH] Convert plain to json instead of doing component conversion in DeathListener (#3821) Closes https://github.com/ViaVersion/ViaVersion/issues/3817 --- .../bukkit/listeners/protocol1_9to1_8/DeathListener.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/DeathListener.java b/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/DeathListener.java index 079096dbd..9f140f1ef 100644 --- a/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/DeathListener.java +++ b/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/DeathListener.java @@ -24,6 +24,7 @@ import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener; import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9; import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8; +import com.viaversion.viaversion.util.ComponentUtil; import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -58,12 +59,12 @@ public class DeathListener extends ViaBukkitListener { // If online UserConnection userConnection = getUserConnection(p); if (userConnection != null) { - PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_9.COMBAT_EVENT, null, userConnection); + PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_9.COMBAT_EVENT, userConnection); try { wrapper.write(Type.VAR_INT, 2); // Event - Entity dead wrapper.write(Type.VAR_INT, p.getEntityId()); // Player ID wrapper.write(Type.INT, p.getEntityId()); // Entity ID - Protocol1_9To1_8.STRING_TO_JSON.write(wrapper, msg); // Message + wrapper.write(Type.COMPONENT, ComponentUtil.plainToJson(msg)); // Message wrapper.scheduleSend(Protocol1_9To1_8.class); } catch (Exception e) {