mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
SPIGOT-6921, #957: Add methods to remove all enchantments on an ItemStack
By: Nothixal <nothixal@gmail.com>
This commit is contained in:
parent
2803610916
commit
7b30278054
2 changed files with 16 additions and 0 deletions
|
@ -449,6 +449,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
|||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all enchantments on this ItemStack.
|
||||
*/
|
||||
public void removeEnchantments() {
|
||||
if (meta == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
meta.removeEnchantments();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@Utility
|
||||
|
|
|
@ -187,6 +187,11 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
|||
*/
|
||||
boolean removeEnchant(@NotNull Enchantment ench);
|
||||
|
||||
/**
|
||||
* Removes all enchantments from this item meta.
|
||||
*/
|
||||
void removeEnchantments();
|
||||
|
||||
/**
|
||||
* Checks if the specified enchantment conflicts with any enchantments in
|
||||
* this ItemMeta.
|
||||
|
|
Loading…
Reference in a new issue