diff --git a/src/main/java/me/blackvein/quests/EventFactory.java b/src/main/java/me/blackvein/quests/EventFactory.java index dcf468a05..b40e588ce 100644 --- a/src/main/java/me/blackvein/quests/EventFactory.java +++ b/src/main/java/me/blackvein/quests/EventFactory.java @@ -404,7 +404,9 @@ public class EventFactory implements ConversationAbandonedListener { text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetItems") + "\n"; LinkedList items = (LinkedList) context.getSessionData(CK.E_ITEMS); for (ItemStack is : items) { - text += ChatColor.GRAY + " - " + ItemUtil.getString(is) + "\n"; + if (is != null) { + text += ChatColor.GRAY + " - " + ItemUtil.getString(is) + "\n"; + } } } if (context.getSessionData(CK.E_EXPLOSIONS) == null) { diff --git a/src/main/java/me/blackvein/quests/util/ItemUtil.java b/src/main/java/me/blackvein/quests/util/ItemUtil.java index bc2fd864d..af1a1e241 100644 --- a/src/main/java/me/blackvein/quests/util/ItemUtil.java +++ b/src/main/java/me/blackvein/quests/util/ItemUtil.java @@ -403,10 +403,13 @@ public class ItemUtil { * Format is ([display]name:durability) x (amount) * * @param is ItemStack to check - * @return true display or item name, plus durability and amount + * @return true display or item name, plus durability and amount, if stack is not null */ @SuppressWarnings("deprecation") public static String getString(ItemStack is) { + if (is == null) { + return null; + } String text; if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) { text = "" + ChatColor.DARK_AQUA + ChatColor.ITALIC + is.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.AQUA + " x " + is.getAmount(); @@ -424,9 +427,12 @@ public class ItemUtil { * Returns a formatted display name. If none exists, returns item name. * * @param is ItemStack to check - * @return true display or item name + * @return true display or item name, if stack is not null */ public static String getName(ItemStack is) { + if (is == null) { + return null; + } String text = ""; if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) { text = "" + ChatColor.DARK_AQUA + ChatColor.ITALIC + is.getItemMeta().getDisplayName();