Skip to content

Commit

Permalink
fix empty nbt
Browse files Browse the repository at this point in the history
  • Loading branch information
casperwtf committed Jun 22, 2024
1 parent 3a0e1ea commit 4c1bc76
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,18 @@ class EcoFastItemStack(
override fun setLoreComponents(lore: List<Component>?) {
val jsonLore = mutableListOf<String>()

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")
Expand Down

0 comments on commit 4c1bc76

Please sign in to comment.