SPIGOT-749: Fix NullPointerException and broken logic in Potion.fromDamage(int)

By: Antony Riley <antony@cyberiantiger.org>
This commit is contained in:
Bukkit/Spigot 2015-07-23 16:18:17 +03:00
parent 00bc2e04a5
commit 953a90bdd3

View File

@ -405,7 +405,7 @@ public class Potion {
if ((damage & SPLASH_BIT) > 0) {
potion = potion.splash();
}
if ((!type.equals(PotionType.INSTANT_DAMAGE) || type.equals(PotionType.FIRE_RESISTANCE)) && (damage & EXTENDED_BIT) > 0) {
if ((type == null || !type.isInstant()) && (damage & EXTENDED_BIT) > 0) {
potion = potion.extend();
}
return potion;