From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Tue, 24 Nov 2020 04:30:34 -0600
Subject: [PATCH] Add critical hit check to EntityDamagedByEntityEvent


diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java
index 869bad7405ec7fa67728e90d8b9f2e11b542611f..05fde759bbdf6068f140b4428bbcb355e22d6b28 100644
--- a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java
@@ -10,15 +10,28 @@ import org.jetbrains.annotations.NotNull;
  */
 public class EntityDamageByEntityEvent extends EntityDamageEvent {
     private final Entity damager;
+    private final boolean isCritical; // Purpur
 
     public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) {
+        // Purpur start
+        this(damager, damagee, cause, damage, false);
+    }
+    public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage, boolean isCritical) {
+        // Purpur end
         super(damagee, cause, damage);
         this.damager = damager;
+        this.isCritical = isCritical; // Purpur
     }
 
     public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
+        // Purpur start
+        this(damager, damagee, cause, modifiers, modifierFunctions, false);
+    }
+    public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions, boolean isCritical) {
+        // Purpur end
         super(damagee, cause, modifiers, modifierFunctions);
         this.damager = damager;
+        this.isCritical = isCritical; // Purpur
     }
 
     /**
@@ -30,4 +43,16 @@ public class EntityDamageByEntityEvent extends EntityDamageEvent {
     public Entity getDamager() {
         return damager;
     }
+
+    // Purpur start
+
+    /**
+     * Whether this damage was done by a critical hit
+     *
+     * @return True if critical hit
+     */
+    public boolean isCritical() {
+        return this.isCritical;
+    }
+    // Purpur end
 }
