3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 02:50:09 +01:00

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

Dieser Commit ist enthalten in:
Jason 2022-04-21 17:07:56 -07:00 committet von GitHub
Ursprung 76ed156764
Commit 567fce6c76
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -132,7 +132,7 @@ index 6bfa984781a483d048ef4318761203c701d8a632..5e0c2c5094e1578162d1a50d50701fbd
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
index b08739dd1ffd041f0885af6c1f57dca9027763b6..2edaae449f936b210a48c52ab8d921544c8a0005 100644
index b08739dd1ffd041f0885af6c1f57dca9027763b6..c1594f62c06a49ba2d0c2c6e6befcda7d1fe6e1b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
@@ -39,11 +39,26 @@ public class CraftThrownPotion extends CraftProjectile implements ThrownPotion {
@ -141,10 +141,10 @@ index b08739dd1ffd041f0885af6c1f57dca9027763b6..2edaae449f936b210a48c52ab8d92154
// 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() + "."); // 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));
+ setPotionMeta(meta); // Paper - Projectile API
+ if (meta != null) this.setPotionMeta(meta); // Paper - Projectile API
}
+ // Paper start - Projectile API