mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-09-18 21:45:12 +00:00
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.
This commit is contained in:
parent
16d0694dcf
commit
3b42b1d170
2 changed files with 1 additions and 7 deletions
|
@ -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");
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Add table
Reference in a new issue