mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 9a129fa99 Add #getEligibleHumans to SkeletonHorseTrapEvent b5e23c7a6 Fix merging spawning values a932e8ad7 Turn off spigot verbose world by default 8ced89f65 Fix Delegation to vanilla chunk gen
57 lines
2.6 KiB
Diff
57 lines
2.6 KiB
Diff
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 869bad740..05fde759b 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
|
|
}
|