fix npe when passing null to displayname for an item in an inventory menu

This commit is contained in:
aurora 2020-09-08 18:08:23 +00:00 committed by Brianna
parent 805fb9d1e8
commit 6b58aa77a0

View File

@ -192,7 +192,7 @@ public class nInventoryUtil {
public Item(ItemStack is, String itemDisplayname, List<String> itemLore, Placeholder[] placeholders, Enchantment[] itemEnchantments, ItemFlag[] itemFlags) {
this.is = is;
this.itemDisplayname = ChatColor.translateAlternateColorCodes('&', itemDisplayname);
this.itemDisplayname = itemDisplayname == null ? null : ChatColor.translateAlternateColorCodes('&', itemDisplayname);
this.itemLore = itemLore;
this.placeholders = placeholders;
this.itemEnchantments = itemEnchantments;