Do not call potion event if no active potion is present.
This commit is contained in:
parent
4179627a47
commit
add3d5f5af
|
@ -11,6 +11,9 @@ public class EntityPotionEffectEventDispatcher {
|
|||
// todo 再检查一遍
|
||||
@SubscribeEvent(receiveCanceled = true)
|
||||
public void onPotionRemove(PotionEvent.PotionRemoveEvent event) {
|
||||
if (event.getPotionEffect() == null) {
|
||||
return;
|
||||
}
|
||||
EntityPotionEffectEvent.Cause cause = ((LivingEntityBridge) event.getEntityLiving()).bridge$getEffectCause().orElse(EntityPotionEffectEvent.Cause.UNKNOWN);
|
||||
EntityPotionEffectEvent.Action action = ((LivingEntityBridge) event.getEntityLiving()).bridge$getAndResetAction();
|
||||
EntityPotionEffectEvent bukkitEvent = CraftEventFactory.callEntityPotionEffectChangeEvent(event.getEntityLiving(), event.getPotionEffect(), null, cause, action);
|
||||
|
|
Loading…
Reference in New Issue
Block a user