From 8a3272c6db056aef72adc2c3474df7872008ae8c Mon Sep 17 00:00:00 2001 From: BuildTools Date: Tue, 13 Nov 2018 23:43:58 -0500 Subject: [PATCH] Catch all exceptions for #521 --- src/main/java/me/blackvein/quests/util/ItemUtil.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/blackvein/quests/util/ItemUtil.java b/src/main/java/me/blackvein/quests/util/ItemUtil.java index 3382522b7..83fa94d7d 100644 --- a/src/main/java/me/blackvein/quests/util/ItemUtil.java +++ b/src/main/java/me/blackvein/quests/util/ItemUtil.java @@ -49,6 +49,7 @@ public class ItemUtil { * @return -4 -> stack display name/lore is unequal
* @return -5 -> stack enchantments are unequal
*/ + @SuppressWarnings("deprecation") public static int compareItems(ItemStack one, ItemStack two, boolean ignoreAmount) { if (one == null || two == null) { return 0; @@ -94,6 +95,7 @@ public class ItemUtil { * @param data formatted string * @return ItemStack, or null if invalid format */ + @SuppressWarnings("deprecation") public static ItemStack readItemStack(String data) { if (data == null) { return null; @@ -110,7 +112,7 @@ public class ItemUtil { if (arg.startsWith("name-")) { try { stack = new ItemStack(Material.matchMaterial(arg.substring(5).toUpperCase())); - } catch (NullPointerException npe) { + } catch (Exception e) { Bukkit.getLogger().severe("[Quests] The item name \'" + arg.substring(5).toUpperCase() + "\' is invalid. Make sure quests.yml is UTF-8 encoded"); return null; } @@ -184,6 +186,7 @@ public class ItemUtil { * @param is ItemStack * @return formatted string, or null if invalid stack */ + @SuppressWarnings("deprecation") public static String serializeItemStack(ItemStack is) { String serial; if (is == null) { @@ -249,6 +252,7 @@ public class ItemUtil { * @param is ItemStack to check * @return true display or item name, plus durability and amount, plus enchantments */ + @SuppressWarnings("deprecation") public static String getDisplayString(ItemStack is) { String text; if (is == null) { @@ -281,6 +285,7 @@ public class ItemUtil { * @param is ItemStack to check * @return true display or item name, plus durability and amount */ + @SuppressWarnings("deprecation") public static String getString(ItemStack is) { String text; if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {