Don't apply previous potion when item is potion (fixes #7756) (#7757)

This commit is contained in:
Jason Penilla 2022-04-21 17:07:56 -07:00
parent ee9fd9f668
commit 49160bd3ac

View File

@ -141,10 +141,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// The ItemStack must be a potion. // The ItemStack must be a potion.
- Validate.isTrue(item.getType() == Material.LINGERING_POTION || item.getType() == Material.SPLASH_POTION, "ItemStack must be a lingering or splash potion. This item stack was " + item.getType() + "."); - Validate.isTrue(item.getType() == Material.LINGERING_POTION || item.getType() == Material.SPLASH_POTION, "ItemStack must be a lingering or splash potion. This item stack was " + item.getType() + ".");
+ //Validate.isTrue(item.getType() == Material.LINGERING_POTION || item.getType() == Material.SPLASH_POTION, "ItemStack must be a lingering or splash potion. This item stack was " + item.getType() + "."); // Paper - Projectile API + //Validate.isTrue(item.getType() == Material.LINGERING_POTION || item.getType() == Material.SPLASH_POTION, "ItemStack must be a lingering or splash potion. This item stack was " + item.getType() + "."); // Paper - Projectile API
+ var meta = getPotionMeta(); // Paper - Projectile API + org.bukkit.inventory.meta.PotionMeta meta = (item.getType() == Material.LINGERING_POTION || item.getType() == Material.SPLASH_POTION) ? null : this.getPotionMeta(); // Paper - Projectile API
this.getHandle().setItem(CraftItemStack.asNMSCopy(item)); this.getHandle().setItem(CraftItemStack.asNMSCopy(item));
+ setPotionMeta(meta); // Paper - Projectile API + if (meta != null) this.setPotionMeta(meta); // Paper - Projectile API
} }
+ // Paper start - Projectile API + // Paper start - Projectile API