From 4c1bc76ee25f53521a0a5ac66b139e7189e774f4 Mon Sep 17 00:00:00 2001 From: Nikolai Connolly Date: Sat, 22 Jun 2024 17:09:23 -0400 Subject: [PATCH] fix empty nbt --- .../spigot/proxy/common/item/EcoFastItemStack.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/eco-core/core-nms/nms-common/src/main/kotlin/com/willfp/eco/internal/spigot/proxy/common/item/EcoFastItemStack.kt b/eco-core/core-nms/nms-common/src/main/kotlin/com/willfp/eco/internal/spigot/proxy/common/item/EcoFastItemStack.kt index f4fb86242..44f7e4e70 100644 --- a/eco-core/core-nms/nms-common/src/main/kotlin/com/willfp/eco/internal/spigot/proxy/common/item/EcoFastItemStack.kt +++ b/eco-core/core-nms/nms-common/src/main/kotlin/com/willfp/eco/internal/spigot/proxy/common/item/EcoFastItemStack.kt @@ -85,10 +85,18 @@ class EcoFastItemStack( override fun setLoreComponents(lore: List?) { val jsonLore = mutableListOf() - if (lore != null) { - for (s in lore) { - jsonLore.add(StringUtils.componentToJson(s)) + if (lore.isNullOrEmpty()) { + val element = handle.getOrCreateTagElement("display") + element.remove("Lore") + if (element.isEmpty) { + handle.removeTagKey("display") } + apply() + return + } + + for (s in lore) { + jsonLore.add(StringUtils.componentToJson(s)) } val displayTag = handle.getOrCreateTagElement("display")