SPIGOT-6921, #957: Add methods to remove all enchantments on an ItemStack
By: Nothixal <nothixal@gmail.com>
This commit is contained in:
@@ -449,6 +449,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
|||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all enchantments on this ItemStack.
|
||||||
|
*/
|
||||||
|
public void removeEnchantments() {
|
||||||
|
if (meta == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
meta.removeEnchantments();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
@Utility
|
@Utility
|
||||||
|
|||||||
@@ -187,6 +187,11 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
|||||||
*/
|
*/
|
||||||
boolean removeEnchant(@NotNull Enchantment ench);
|
boolean removeEnchant(@NotNull Enchantment ench);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all enchantments from this item meta.
|
||||||
|
*/
|
||||||
|
void removeEnchantments();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the specified enchantment conflicts with any enchantments in
|
* Checks if the specified enchantment conflicts with any enchantments in
|
||||||
* this ItemMeta.
|
* this ItemMeta.
|
||||||
|
|||||||
Reference in New Issue
Block a user