From a324e97a247c4f6d3e2a3cc2db7352bea6ae1c5b Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Mon, 31 Jul 2017 01:49:48 -0500 Subject: [PATCH] LivingEntity#setKiller diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index e6b48cc0ea..88688be668 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -80,7 +80,7 @@ public abstract class EntityLiving extends Entity { public float aL; public float aM; public EntityHuman killer; - protected int lastDamageByPlayerTime; + public int lastDamageByPlayerTime; // Paper - protected -> public protected boolean killed; protected int ticksFarFromPlayer; protected float aR; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index da86ee4149..1760dfa7a3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -318,6 +318,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity(); } + // Paper start + @Override + public void setKiller(Player killer) { + net.minecraft.server.EntityPlayer entityPlayer = killer == null ? null : ((CraftPlayer) killer).getHandle(); + getHandle().killer = entityPlayer; + getHandle().lastDamager = entityPlayer; + getHandle().lastDamageByPlayerTime = entityPlayer == null ? 0 : 100; // 100 value taken from EntityLiving#damageEntity + } + // Paper end + @Override public boolean addPotionEffect(PotionEffect effect) { return addPotionEffect(effect, false); -- 2.26.2