[SPIGOT-5954] API to use a TextComponent for Nameable#setCustomName Created: 06/Jul/20  Updated: 31/Aug/22

Status: Open
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: Jason Penilla Assignee: Parker Hawke
Resolution: Unresolved Votes: 1
Labels: None

Attachments: PNG File 2020-07-06_16.42.09.png    
Version: 1.16
Guidelines Read: Yes

 Description   

It would be great if we could set the custom name of an entity using a Component instead of just a String. Currently this can be done using the NMS method setCustomName, but this is really something we shouldn't need NMS for, imo.



 Comments   
Comment by Sentropic [ 16/Mar/22 ]

This would also enable the possibility of using TranslatableComponents, so one more reason on top of custom fonts.

Comment by FACEGUY [ 08/Jul/20 ]

Seeing similar issues attempting to use BaseComponent.toLegacyText. It also removes "italic":"false" that has been set in the BaseComponent.

Comment by Jason Penilla [ 07/Jul/20 ]

When I use BaseComponent.toLegacyText for non-hex colors it works fine, with hex colors I get the pictured result.

Comment by Jason Penilla [ 06/Jul/20 ]

This is a side by side of when I use NMS setCustomName, and when I do BaseComponent.toLegacyText on the same message. Is it possible it's broken for hex or am I missing something?

Comment by md_5 [ 06/Jul/20 ]

BaseComponent.toLegacyText

Comment by Jason Penilla [ 06/Jul/20 ]

My reason is I'm using a third party library to parse text (adventure-text-minimessage) and my resulting text is a component wrapper that I can get a TextComponent from or I can get an NMS IChatBaseComponent from. If theres a way I can go from TextComponent to legacy text that I don't know about that would solve my use case as well.

Comment by md_5 [ 06/Jul/20 ]

RGB is already possible, so its just fonts

Comment by Parker Hawke [ 06/Jul/20 ]

Most notably, RGB and fonts I think are the biggest concern here. Click and hover events are off the table most everywhere outside of chat.

Comment by md_5 [ 06/Jul/20 ]

It would help if you said what you needed a component for that couldn't be done with the existing API

Comment by Parker Hawke [ 06/Jul/20 ]

I think, quite honestly, that we should start adding API methods to use text components pretty much across the board. Though I'd imagine md has a reason not to do this. My first guess would be incompatibility with Bukkit and the fact that it is currently using (and will likely continue to use) legacy chat.

Generated at Mon Dec 15 03:49:30 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.