Since I figured my problem out, how would I set correct capitalization for a material item Example of my thought https://gyazo.com/e8abe361985db9fe9dcf38d90995ac53
If you want the item name, I would create an item stack with that item, and then get the display name. I don’t know if you can get the item name directly from a material.
@johnnyD Something like this? Code:Java StringBuilder sb = new StringBuilder();for (String word : material.name().replace('_', ' ').toLowerCase().split(" ")) sb.append(word.substring(0, 1).toUpperCase() + word.substring(1)).append(' ');String name = sb.toString().trim();
@KarimAKL that still relies on the Material enum name tho, and those aren't really true to the localized item name right?
@Machine Maker The question wasn't about how to get the item's name, it was about capitalization. The OP's code is using the Material#toString() method as well so, it's not much different. I did also ask a question: Also, about your suggestion: Using ItemMeta#getDisplayName() will result in null if used on an item with no custom name. I believe this is because the item name is client side, which is also the reason item names change language when you change the game language. There's no method for that. You can't get the item name for every player so, no, it doesn't match the item name if the client language isn't English.