diff options
Diffstat (limited to 'patches/server/0244-Improve-death-events.patch')
-rw-r--r-- | patches/server/0244-Improve-death-events.patch | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/patches/server/0244-Improve-death-events.patch b/patches/server/0244-Improve-death-events.patch index b4abf99a98..b4d51a0bb0 100644 --- a/patches/server/0244-Improve-death-events.patch +++ b/patches/server/0244-Improve-death-events.patch @@ -19,7 +19,7 @@ public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sou public net.minecraft.world.entity.LivingEntity getSoundVolume()F diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 622f890d2613acf948b68d6febe0834ceec23c80..5bf3f2faac0af6bddfd2ecb423a13cdf0dd1af1b 100644 +index 7c00c4244233cee313127c1e8c06ef9288d5b9b1..91cc0488c37f60035d99aa310d99d5b8377dbafe 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -268,6 +268,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -80,7 +80,7 @@ index 622f890d2613acf948b68d6febe0834ceec23c80..5bf3f2faac0af6bddfd2ecb423a13cdf } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 4bf729db65070ac34f7dd84cf16a9475db2ff7c0..2c426a68f72b1ed234529b02d2e1d2c18563414b 100644 +index f7a77b31dc196823510f96bd3b2344058e20feac..279fa00fd9043e1995f22c79f47d0b41c27bd933 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -283,6 +283,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -91,7 +91,7 @@ index 4bf729db65070ac34f7dd84cf16a9475db2ff7c0..2c426a68f72b1ed234529b02d2e1d2c1 @Override public float getBukkitYaw() { -@@ -1526,11 +1527,12 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1537,11 +1538,12 @@ public abstract class LivingEntity extends Entity implements Attackable { if (this.isDeadOrDying()) { if (!this.checkTotemDeathProtection(source)) { @@ -107,7 +107,7 @@ index 4bf729db65070ac34f7dd84cf16a9475db2ff7c0..2c426a68f72b1ed234529b02d2e1d2c1 } } else if (flag1) { this.playHurtSound(source); -@@ -1689,6 +1691,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1700,6 +1702,7 @@ public abstract class LivingEntity extends Entity implements Attackable { Entity entity = damageSource.getEntity(); LivingEntity entityliving = this.getKillCredit(); @@ -115,7 +115,7 @@ index 4bf729db65070ac34f7dd84cf16a9475db2ff7c0..2c426a68f72b1ed234529b02d2e1d2c1 if (this.deathScore >= 0 && entityliving != null) { entityliving.awardKillScore(this, this.deathScore, damageSource); } -@@ -1700,24 +1703,59 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1711,24 +1714,59 @@ public abstract class LivingEntity extends Entity implements Attackable { if (!this.level().isClientSide && this.hasCustomName()) { if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot } @@ -179,7 +179,7 @@ index 4bf729db65070ac34f7dd84cf16a9475db2ff7c0..2c426a68f72b1ed234529b02d2e1d2c1 } } -@@ -1725,7 +1763,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1736,7 +1774,7 @@ public abstract class LivingEntity extends Entity implements Attackable { if (!this.level().isClientSide) { boolean flag = false; @@ -188,7 +188,7 @@ index 4bf729db65070ac34f7dd84cf16a9475db2ff7c0..2c426a68f72b1ed234529b02d2e1d2c1 if (this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { BlockPos blockposition = this.blockPosition(); BlockState iblockdata = Blocks.WITHER_ROSE.defaultBlockState(); -@@ -1754,24 +1792,37 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1765,24 +1803,37 @@ public abstract class LivingEntity extends Entity implements Attackable { } } @@ -423,10 +423,10 @@ index ee3902cbada46ffb78c42dbf6f00c859546c76e1..92bb0c63330ad3a4cb13b2dc65502071 // CraftBukkit end this.gameEvent(GameEvent.ENTITY_DIE); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index c0b92358c03d1724e8c134563f9ca98e69081c6a..a33fc9288165ec013cef6b90d72871f0058c0857 100644 +index e55a8171ba65e1ca499ba3c6aaab9a63702fc298..ebb465cbc60d09d0087d2545ebd3b455bf5216de 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2516,7 +2516,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2517,7 +2517,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void sendHealthUpdate() { FoodData foodData = this.getHandle().getFoodData(); @@ -443,10 +443,10 @@ index c0b92358c03d1724e8c134563f9ca98e69081c6a..a33fc9288165ec013cef6b90d72871f0 public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 635982e7c9bb650f72a987e2f866d6f91b75efcf..5254a97f94d24717bdbba1768fffc3d8d292f0fe 100644 +index 1d2e9f3e5e232faca8de4760d3574fae6200b2b2..e7ba5b503e821d18467c2300f780ef37f996b34d 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -893,9 +893,16 @@ public class CraftEventFactory { +@@ -894,9 +894,16 @@ public class CraftEventFactory { CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource); EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity())); @@ -463,12 +463,11 @@ index 635982e7c9bb650f72a987e2f866d6f91b75efcf..5254a97f94d24717bdbba1768fffc3d8 victim.expToDrop = event.getDroppedExp(); for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { -@@ -913,8 +920,15 @@ public class CraftEventFactory { +@@ -914,7 +921,14 @@ public class CraftEventFactory { PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()), 0, deathMessage); event.setKeepInventory(keepInventory); event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel + populateFields(victim, event); // Paper - make cancellable - org.bukkit.World world = entity.getWorld(); Bukkit.getServer().getPluginManager().callEvent(event); + // Paper start - make cancellable + if (event.isCancelled()) { |