Commits

olivervscreeper authored and md_5 committed fe015deb2ac
Checked for instant potions, to fix NPE in serialization.

Fixes SPIGOT-749
No tags

src/main/java/org/bukkit/potion/Potion.java

Modified
398 398 if (type == null || type == PotionType.WATER) {
399 399 potion = new Potion(damage & NAME_BIT);
400 400 } else {
401 401 int level = (damage & TIER_BIT) >> TIER_SHIFT;
402 402 level++;
403 403 potion = new Potion(type, level);
404 404 }
405 405 if ((damage & SPLASH_BIT) > 0) {
406 406 potion = potion.splash();
407 407 }
408 - if ((damage & EXTENDED_BIT) > 0) {
408 + if ((!type.equals(PotionType.INSTANT_DAMAGE) || type.equals(PotionType.FIRE_RESISTANCE)) && (damage & EXTENDED_BIT) > 0) {
409 409 potion = potion.extend();
410 410 }
411 411 return potion;
412 412 }
413 413
414 414 public static Potion fromItemStack(ItemStack item) {
415 415 Validate.notNull(item, "item cannot be null");
416 416 if (item.getType() != Material.POTION)
417 417 throw new IllegalArgumentException("item is not a potion");
418 418 return fromDamage(item.getDurability());

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut