Add Enchantment#isTreasure()Z

Determines if the enchantment is a treasure enchantment - only available via means other than the enchantment table.

By: Senmori <thesenmori@gmail.com>
This commit is contained in:
Bukkit/Spigot 2016-10-25 11:16:28 -04:00
parent a05a1330d3
commit bde8f61893
2 changed files with 15 additions and 0 deletions

View file

@ -194,6 +194,16 @@ public abstract class Enchantment {
*/ */
public abstract EnchantmentTarget getItemTarget(); 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. * Check if this enchantment conflicts with another enchantment.
* *

View file

@ -44,6 +44,11 @@ public class EnchantmentWrapper extends Enchantment {
return getEnchantment().getName(); return getEnchantment().getName();
} }
@Override
public boolean isTreasure() {
return getEnchantment().isTreasure();
}
@Override @Override
public boolean conflictsWith(Enchantment other) { public boolean conflictsWith(Enchantment other) {
return getEnchantment().conflictsWith(other); return getEnchantment().conflictsWith(other);