testserver/Bukkit-Patches/0002-Fix-damage-bug-Fixes-B...

25 lines
990 B
Diff

From 990816b6568d211f62cdd1b7538f52c1c096c1d4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 7 Jul 2014 23:26:59 -0400
Subject: [PATCH] Fix damage bug - Fixes BUKKIT-5678
If a plugin lowers the damage in EntityDamageEvent while also having damage reduction modifiers,
the entity will in turn be able to receive absorption buff on every hit, making them invincible.
diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
index 17d9548..a4b9eb2 100644
--- a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
@@ -135,7 +135,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
for (DamageModifier modifier : MODIFIERS) {
damage += getDamage(modifier);
}
- return damage;
+ return Math.max(damage, 0); // Spigot
}
/**
--
1.9.1