Paper/Spigot-Server-Patches/0202-LivingEntity-setKiller.patch
Aikar 459987d69f
More improvements to activation range, improve turtles
improved the water code so that immunity wont trigger if the entity
has the water pathfinder system active, so this improves support
for all entities that know how to behave in water.

Merged 2 EAR patches together, and removed an MCUtil method that
doesnt have a purpose anymore
2018-10-04 23:18:46 -04:00

31 lines
1.3 KiB
Diff

From 9c88a6860c9857c1ab2423f6edd26e11d5836772 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 31 Jul 2017 01:49:48 -0500
Subject: [PATCH] LivingEntity#setKiller
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 09cf843d46..9acafadbbf 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -253,6 +253,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
+
public boolean addPotionEffect(PotionEffect effect) {
return addPotionEffect(effect, false);
}
--
2.19.0