aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0200-LivingEntity-setKiller.patch
blob: af2973c39c4b983f8946ba04d0682ac4d65bf2b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From f2fdf943d649d1e7f0dd770429734dbedf0a169c 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 716eda990..2f96842bb 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -278,6 +278,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.21.0