testserver/Spigot-Server-Patches/0166-LivingEntity-setKiller...

41 lines
2.0 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2017-08-24 19:18:41 +00:00
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 31 Jul 2017 01:49:48 -0500
Subject: [PATCH] LivingEntity#setKiller
2019-05-06 02:58:04 +00:00
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 729726782446085a6c3b811c4b540ff154c6c115..e8e91a415daef307a3793dd36ebb71d3cbd7b079 100644
2019-05-06 02:58:04 +00:00
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
2020-06-25 13:11:48 +00:00
@@ -86,7 +86,7 @@ public abstract class EntityLiving extends Entity {
public float aE;
2020-06-25 13:11:48 +00:00
@Nullable
2019-05-06 02:58:04 +00:00
public EntityHuman killer;
- protected int lastDamageByPlayerTime;
+ public int lastDamageByPlayerTime; // Paper - protected -> public
protected boolean killed;
protected int ticksFarFromPlayer;
protected float aJ;
2017-08-24 19:18:41 +00:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index dd12147fd5b37b0b6e54568d65f571534d0b3c67..0fade6225316e507c989bb265f94a1fa882473ce 100644
2017-08-24 19:18:41 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -323,6 +323,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
2017-08-24 19:18:41 +00:00
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();
2017-08-24 19:18:41 +00:00
+ getHandle().killer = entityPlayer;
+ getHandle().lastDamager = entityPlayer;
+ getHandle().lastDamageByPlayerTime = entityPlayer == null ? 0 : 100; // 100 value taken from EntityLiving#damageEntity
+ }
+ // Paper end
+
2019-05-06 02:58:04 +00:00
@Override
2017-08-24 19:18:41 +00:00
public boolean addPotionEffect(PotionEffect effect) {
return addPotionEffect(effect, false);