-
Notifications
You must be signed in to change notification settings - Fork 0
ItemUtils
Fulminazzo edited this page Oct 2, 2023
·
1 revision
public class ItemUtils {
/**
* Returns the item of a name. If it is not present, it will return the item material name.
* @param itemStack: the item.
*
* @return the name of the item.
*/
public static String getItemName(ItemStack itemStack) {
if (itemStack == null) return "NULL";
else {
ItemMeta itemMeta = itemStack.getItemMeta();
String displayName = itemMeta == null ? null : itemMeta.getDisplayName();
if (displayName == null || displayName.isEmpty()) displayName = StringUtils.capitalize(itemStack.getType().name());
return displayName;
}
}
}
- Home
- How to start a plugin
- Work with Configuration Files
- Work with Enums
- Work with Commands
- Work with Custom Players
- Work with Messaging Channels
- Creating custom SavableObjects
- Timers
- General Utils
- Placeholders
- Bukkit Utils
- Velocity Utils