From 0477cd71a0cb7e4b2d636525fa77b7dd99fe211c Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sun, 3 Jun 2012 08:23:30 -0500 Subject: [PATCH] Don't "setLastDamageCause" in the DamageEvent constructor. Addresses BUKKIT-1881 This is now done after the event to allow you to be able to get previous damageCauses, and is now only applied if the event is not canceled. By: feildmaster --- .../main/java/org/bukkit/command/defaults/KillCommand.java | 1 + .../java/org/bukkit/event/entity/EntityDamageEvent.java | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/command/defaults/KillCommand.java b/paper-api/src/main/java/org/bukkit/command/defaults/KillCommand.java index e9d6f2a797..0deff08cc2 100644 --- a/paper-api/src/main/java/org/bukkit/command/defaults/KillCommand.java +++ b/paper-api/src/main/java/org/bukkit/command/defaults/KillCommand.java @@ -24,6 +24,7 @@ public class KillCommand extends VanillaCommand { Bukkit.getPluginManager().callEvent(ede); if (ede.isCancelled()) return true; + ede.getEntity().setLastDamageCause(ede); player.damage(ede.getDamage()); } else { sender.sendMessage("You can only perform this command as a player"); diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java index 2fa2c4656e..f059b407ad 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java @@ -1,6 +1,5 @@ package org.bukkit.event.entity; -import org.bukkit.entity.ComplexEntityPart; import org.bukkit.entity.Entity; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; @@ -18,12 +17,6 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable { super(damagee); this.cause = cause; this.damage = damage; - - if (damagee instanceof ComplexEntityPart) { - ((ComplexEntityPart) damagee).getParent().setLastDamageCause(this); - } else { - damagee.setLastDamageCause(this); - } } public boolean isCancelled() {