This commit is contained in:
Magnus Ulf 2019-05-20 00:22:52 +02:00
parent 1618da1083
commit d0960911b8

View File

@ -14,6 +14,7 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Trident;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.entity.EntityCombustByEntityEvent;
@ -42,11 +43,14 @@ public class EngineCanCombatHappen extends Engine
event.setCancelled(true); event.setCancelled(true);
Entity damager = event.getDamager(); Entity damager = event.getDamager();
if ( ! (damager instanceof Arrow)) return; if (damager instanceof Arrow && !(damager instanceof Trident) )
{
damager.remove(); damager.remove();
} }
}
// mainly for flaming arrows; don't want allies or people in safe zones to be ignited even after damage event is cancelled // mainly for flaming arrows; don't want allies or people in safe zones to be ignited even after damage event is cancelled
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void canCombatDamageHappen(EntityCombustByEntityEvent event) public void canCombatDamageHappen(EntityCombustByEntityEvent event)
@ -110,6 +114,7 @@ public class EngineCanCombatHappen extends Engine
// ... fast evaluate if the attacker is overriding ... // ... fast evaluate if the attacker is overriding ...
if (MUtil.isPlayer(eattacker)) if (MUtil.isPlayer(eattacker))
{ {
MPlayer mplayer = MPlayer.get(eattacker); MPlayer mplayer = MPlayer.get(eattacker);
if (mplayer != null && mplayer.isOverriding()) return true; if (mplayer != null && mplayer.isOverriding()) return true;
} }