diff --git a/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java b/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java index a23ee5c3e5..5348f5c4a8 100644 --- a/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java +++ b/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java @@ -194,6 +194,16 @@ public abstract class Enchantment { */ public abstract EnchantmentTarget getItemTarget(); + /** + * Checks if this enchantment is a treasure enchantment. + *
+ * Treasure enchantments can only be received via looting, trading, or + * fishing. + * + * @return true if the enchantment is a treasure enchantment + */ + public abstract boolean isTreasure(); + /** * Check if this enchantment conflicts with another enchantment. * diff --git a/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java index 6a0aeb3efd..5ff4b48e37 100644 --- a/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java +++ b/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java @@ -44,6 +44,11 @@ public class EnchantmentWrapper extends Enchantment { return getEnchantment().getName(); } + @Override + public boolean isTreasure() { + return getEnchantment().isTreasure(); + } + @Override public boolean conflictsWith(Enchantment other) { return getEnchantment().conflictsWith(other);