geforkt von Mirrors/Paper
SPIGOT-6921, #1330: Add methods to remove all enchantments on an ItemStack
By: Nothixal <nothixal@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
7581cde32e
Commit
753db7f2fc
@ -273,6 +273,11 @@ public final class CraftItemStack extends ItemStack {
|
|||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeEnchantments() {
|
||||||
|
handle.getTag().remove(ENCHANTMENTS.NBT);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Enchantment, Integer> getEnchantments() {
|
public Map<Enchantment, Integer> getEnchantments() {
|
||||||
return getEnchantments(handle);
|
return getEnchantments(handle);
|
||||||
|
@ -834,6 +834,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|||||||
return enchantmentRemoved;
|
return enchantmentRemoved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeEnchantments() {
|
||||||
|
if (hasEnchants()) {
|
||||||
|
enchantments.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasEnchants() {
|
public boolean hasEnchants() {
|
||||||
return !(enchantments == null || enchantments.isEmpty());
|
return !(enchantments == null || enchantments.isEmpty());
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren