From dd1f63cf0522efc44e0adde2b9b94d810ea17248 Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Tue, 3 Dec 2024 00:23:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BC=BA=E5=88=B6=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=BF=80=E5=85=89=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/event/LivingEventHandler.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java index 9f5559137..0c5b9d8e0 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java @@ -1,6 +1,8 @@ package com.atsuishio.superbwarfare.event; import com.atsuishio.superbwarfare.ModUtils; +import com.atsuishio.superbwarfare.capability.LaserCapability; +import com.atsuishio.superbwarfare.capability.ModCapabilities; import com.atsuishio.superbwarfare.config.common.GameplayConfig; import com.atsuishio.superbwarfare.entity.ICannonEntity; import com.atsuishio.superbwarfare.entity.TargetEntity; @@ -80,6 +82,10 @@ public class LivingEventHandler { handlePlayerKillEntity(event); handlePlayerDeathDropAmmo(event.getEntity()); giveKillExpToWeapon(event); + + if (event.getEntity() instanceof Player player) { + handlePlayerBeamReset(player); + } } /** @@ -725,4 +731,8 @@ public class LivingEventHandler { event.setCanceled(true); } } + + public static void handlePlayerBeamReset(Player player) { + player.getCapability(ModCapabilities.LASER_CAPABILITY).ifPresent(LaserCapability.ILaserCapability::end); + } }