How to set ItemMeta display name with ItemMeta#displayName method?

littleBitsman

New member
Sep 14, 2022
1
0
1
I am new to PaperMC plugin development as I used Bukkit before which supported ItemMeta#setDisplayName, but on Paper the same method is deprecated. How do I use ItemMeta#displayName(Component)?
Version: 1.17.1
 

WithLithum

New member
Jun 12, 2022
1
0
1
Use the Component.text(string) method to create a Component to use that method:
Java:
meta.displayName(Component.text("Something"))

For further usage on Components, have a look at the Adventure documentation.