Fix damage bug - Fixes BUKKIT-5678

This commit is contained in:
Aikar 2014-07-07 23:14:51 -05:00 committed by Zach Brown
parent bba86b10b2
commit 2cac033679

View File

@ -0,0 +1,24 @@
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