SPIGOT-7902, #1477: Fix CraftMetaPotion#hasCustomEffects() does not check if customEffects (List) is empty

By: James Perry <beanp02@yahoo.com>
This commit is contained in:
CraftBukkit/Spigot 2024-09-27 08:35:25 +10:00
parent 060be9b96a
commit 074c4c011e

View file

@ -115,6 +115,10 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
void applyToItem(CraftMetaItem.Applicator tag) {
super.applyToItem(tag);
if (isPotionEmpty()) {
return;
}
Optional<Holder<PotionRegistry>> defaultPotion = (hasBasePotionType()) ? Optional.of(CraftPotionType.bukkitToMinecraftHolder(type)) : Optional.empty();
Optional<Integer> potionColor = (hasColor()) ? Optional.of(this.color.asRGB()) : Optional.empty();
@ -174,7 +178,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
@Override
public boolean hasCustomEffects() {
return customEffects != null;
return customEffects != null && !customEffects.isEmpty();
}
@Override