diff --git a/Spigot-API-Patches/ItemStack-API-additions-for-quantity-flags-lore.patch b/Spigot-API-Patches/ItemStack-API-additions-for-quantity-flags-lore.patch index 29f11c8436..3470e5404a 100644 --- a/Spigot-API-Patches/ItemStack-API-additions-for-quantity-flags-lore.patch +++ b/Spigot-API-Patches/ItemStack-API-additions-for-quantity-flags-lore.patch @@ -110,6 +110,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ + public void setLore(@Nullable List<String> lore) { + ItemMeta itemMeta = getItemMeta(); ++ if (itemMeta == null) { ++ throw new IllegalStateException("Cannot set lore on " + getType()); ++ } + itemMeta.setLore(lore); + setItemMeta(itemMeta); + } @@ -121,6 +124,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ + public void addItemFlags(@NotNull ItemFlag... itemFlags) { + ItemMeta itemMeta = getItemMeta(); ++ if (itemMeta == null) { ++ throw new IllegalStateException("Cannot add flags on " + getType()); ++ } + itemMeta.addItemFlags(itemFlags); + setItemMeta(itemMeta); + } @@ -132,6 +138,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ + public void removeItemFlags(@NotNull ItemFlag... itemFlags) { + ItemMeta itemMeta = getItemMeta(); ++ if (itemMeta == null) { ++ throw new IllegalStateException("Cannot remove flags on " + getType()); ++ } + itemMeta.removeItemFlags(itemFlags); + setItemMeta(itemMeta); + } @@ -144,6 +153,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @NotNull + public Set<ItemFlag> getItemFlags() { + ItemMeta itemMeta = getItemMeta(); ++ if (itemMeta == null) { ++ return java.util.Collections.emptySet(); ++ } + return itemMeta.getItemFlags(); + } + @@ -155,7 +167,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ + public boolean hasItemFlag(@NotNull ItemFlag flag) { + ItemMeta itemMeta = getItemMeta(); -+ return itemMeta.hasItemFlag(flag); ++ return itemMeta != null && itemMeta.hasItemFlag(flag); + } // Paper end }