SPIGOT-7655: ItemMeta#addItemFlags(ItemFlag.HIDE_ATTRIBUTES) not working when no attribute modifiers set

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2024-05-02 21:00:12 +10:00
parent 23b13ad11a
commit 54dd884d80

View file

@ -821,6 +821,9 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
void applyModifiers(Multimap<Attribute, AttributeModifier> modifiers, CraftMetaItem.Applicator tag) {
if (modifiers == null || modifiers.isEmpty()) {
if (hasItemFlag(ItemFlag.HIDE_ATTRIBUTES)) {
tag.put(ATTRIBUTES, new ItemAttributeModifiers(Collections.emptyList(), false));
}
return;
}