diff options
-rw-r--r-- | src/main/java/org/bukkit/enchantments/Enchantment.java | 10 | ||||
-rw-r--r-- | src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java index a23ee5c3..5348f5c4 100644 --- a/src/main/java/org/bukkit/enchantments/Enchantment.java +++ b/src/main/java/org/bukkit/enchantments/Enchantment.java @@ -195,6 +195,16 @@ public abstract class Enchantment { public abstract EnchantmentTarget getItemTarget(); /** + * Checks if this enchantment is a treasure enchantment. + * <br> + * 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. * * @param other The enchantment to check against diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java index 6a0aeb3e..5ff4b48e 100644 --- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java +++ b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java @@ -45,6 +45,11 @@ public class EnchantmentWrapper extends Enchantment { } @Override + public boolean isTreasure() { + return getEnchantment().isTreasure(); + } + + @Override public boolean conflictsWith(Enchantment other) { return getEnchantment().conflictsWith(other); } |