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

  • After careful consideration and due to limited usage, we’ve made the decision to discontinue the PaperMC forums. Moving forward, we recommend using Hangar for plugin uploads, and for all other community discussions and support, please join us on Discord.

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.