Skip to content

Commit

Permalink
Persist intentionally empty item display names
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 6, 2022
1 parent a592be1 commit 654ba9e
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -10,6 +10,7 @@
import com.denizenscript.denizencore.tags.core.EscapeTagBase;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import com.denizenscript.denizen.utilities.BukkitImplDeprecations;
import org.bukkit.ChatColor;
import org.bukkit.inventory.meta.ItemMeta;

public class ItemDisplayname implements Property {
Expand Down Expand Up @@ -88,7 +89,11 @@ public ObjectTag getObjectAttribute(Attribute attribute) {
@Override
public String getPropertyString() {
if (hasDisplayName()) {
return NMSHandler.itemHelper.getDisplayName(item);
String res = NMSHandler.itemHelper.getDisplayName(item);
if (res.isEmpty()) { // Special case: persist empty strings as a single empty color code so it's not ignored
return ChatColor.WHITE.toString();
}
return res;
}
else {
return null;
Expand Down

0 comments on commit 654ba9e

Please sign in to comment.