From 784728bcc775a3ae41671a3bd0fd6bdb86c49a1e Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Mon, 10 May 2021 00:25:35 -0700 Subject: [PATCH] Add missing rarity method on ItemStack (#5594) --- Spigot-API-Patches/Item-Rarity-API.patch | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Spigot-API-Patches/Item-Rarity-API.patch b/Spigot-API-Patches/Item-Rarity-API.patch index 22c18709b5..a13b021173 100644 --- a/Spigot-API-Patches/Item-Rarity-API.patch +++ b/Spigot-API-Patches/Item-Rarity-API.patch @@ -86,3 +86,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack); // Paper end } +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor + ItemMeta itemMeta = getItemMeta(); + return itemMeta != null && itemMeta.hasItemFlag(flag); + } ++ ++ /** ++ * Gets the item rarity of the itemstack. The rarity can change based on enchantements. ++ * ++ * @return the itemstack rarity ++ */ ++ @NotNull ++ public io.papermc.paper.inventory.ItemRarity getRarity() { ++ return Bukkit.getUnsafe().getItemStackRarity(this); ++ } + // Paper end + }