geforkt von Mirrors/Paper
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 <admin@feildmaster.com>
Dieser Commit ist enthalten in:
Ursprung
a767f3fed8
Commit
0477cd71a0
@ -24,6 +24,7 @@ public class KillCommand extends VanillaCommand {
|
|||||||
Bukkit.getPluginManager().callEvent(ede);
|
Bukkit.getPluginManager().callEvent(ede);
|
||||||
if (ede.isCancelled()) return true;
|
if (ede.isCancelled()) return true;
|
||||||
|
|
||||||
|
ede.getEntity().setLastDamageCause(ede);
|
||||||
player.damage(ede.getDamage());
|
player.damage(ede.getDamage());
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("You can only perform this command as a player");
|
sender.sendMessage("You can only perform this command as a player");
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package org.bukkit.event.entity;
|
package org.bukkit.event.entity;
|
||||||
|
|
||||||
import org.bukkit.entity.ComplexEntityPart;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@ -18,12 +17,6 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
|||||||
super(damagee);
|
super(damagee);
|
||||||
this.cause = cause;
|
this.cause = cause;
|
||||||
this.damage = damage;
|
this.damage = damage;
|
||||||
|
|
||||||
if (damagee instanceof ComplexEntityPart) {
|
|
||||||
((ComplexEntityPart) damagee).getParent().setLastDamageCause(this);
|
|
||||||
} else {
|
|
||||||
damagee.setLastDamageCause(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren