From 074c4c011eba2603bc7d51e1080c55d096c3d358 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Fri, 27 Sep 2024 08:35:25 +1000 Subject: [PATCH] SPIGOT-7902, #1477: Fix CraftMetaPotion#hasCustomEffects() does not check if customEffects (List) is empty By: James Perry --- .../org/bukkit/craftbukkit/inventory/CraftMetaPotion.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java index 8bdc853c20..c40905f4b9 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java @@ -115,6 +115,10 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta { void applyToItem(CraftMetaItem.Applicator tag) { super.applyToItem(tag); + if (isPotionEmpty()) { + return; + } + Optional> defaultPotion = (hasBasePotionType()) ? Optional.of(CraftPotionType.bukkitToMinecraftHolder(type)) : Optional.empty(); Optional 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