From add3d5f5af9a3e09c2ec5ca3c96f897192a2dc3f Mon Sep 17 00:00:00 2001 From: IzzelAliz Date: Sun, 17 May 2020 13:13:02 +0800 Subject: [PATCH] Do not call potion event if no active potion is present. --- .../mod/server/event/EntityPotionEffectEventDispatcher.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arclight-coremod/src/main/java/io/izzel/arclight/mod/server/event/EntityPotionEffectEventDispatcher.java b/arclight-coremod/src/main/java/io/izzel/arclight/mod/server/event/EntityPotionEffectEventDispatcher.java index e1179f1d..85591fea 100644 --- a/arclight-coremod/src/main/java/io/izzel/arclight/mod/server/event/EntityPotionEffectEventDispatcher.java +++ b/arclight-coremod/src/main/java/io/izzel/arclight/mod/server/event/EntityPotionEffectEventDispatcher.java @@ -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);