mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 08:20:51 +01:00
30 lines
1.5 KiB
Diff
30 lines
1.5 KiB
Diff
From 0000000000000000000000000000000000000000 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
|
|
|
|
== AT ==
|
|
public net.minecraft.world.entity.LivingEntity lastHurtByPlayerTime
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
index 4a2f49be0af5d88e0fe5dd8af00b77dd0da2f208..d77c31a8b41df69d11c1ce4b77975e9a38e317b3 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -405,6 +405,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|
return this.getHandle().lastHurtByPlayer == null ? null : (Player) this.getHandle().lastHurtByPlayer.getBukkitEntity();
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public void setKiller(Player killer) {
|
|
+ net.minecraft.server.level.ServerPlayer entityPlayer = killer == null ? null : ((CraftPlayer) killer).getHandle();
|
|
+ getHandle().lastHurtByPlayer = entityPlayer;
|
|
+ getHandle().lastHurtByMob = entityPlayer;
|
|
+ getHandle().lastHurtByPlayerTime = entityPlayer == null ? 0 : 100; // 100 value taken from EntityLiving#damageEntity
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public boolean addPotionEffect(PotionEffect effect) {
|
|
return this.addPotionEffect(effect, false);
|