Fix potion remove event not always firing, add expiry event

This commit is contained in:
tterrag committed 2018-12-02 13:20:02 -05:00
1 parent f1d1e8853b
commit dd27209565
3 files changed
+92 -35

No files matched your search

@@ -61,10 +61,16 @@ public class PotionEvent extends LivingEvent
public PotionRemoveEvent(EntityLivingBase living, Potion potion)
{
super(living, living.getActivePotionMap().get(potion));
super(living, living.getActivePotionEffect(potion));
this.potion = potion;
}
public PotionRemoveEvent(EntityLivingBase living, PotionEffect effect)
{
super(living, effect);
this.potion = effect.getPotion();
}
/**
* @return the Potion which is tried to remove from the Entity.
*/
@@ -146,4 +152,16 @@ public class PotionEvent extends LivingEvent
}
}
/**
* This Event is fired when a Potion effect expires on an Entity.
* This Event is not {@link Cancelable}
* This Event does not have a Result.
*/
public static class PotionExpiryEvent extends PotionEvent
{
public PotionExpiryEvent(EntityLivingBase living, PotionEffect effect)
{
super(living, effect);
}
}
}