[ci skip] Cleanup events (#10202)

This commit is contained in:
Lulu13022002
2024-02-01 10:15:57 +01:00
parent d676979ea0
commit f7e469eb2e
187 changed files with 2415 additions and 2258 deletions

View File

@@ -110,10 +110,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else if (flag1) {
this.playHurtSound(source);
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!this.isRemoved() && !this.dead) {
Entity entity = damageSource.getEntity();
LivingEntity entityliving = this.getKillCredit();
-
+ /* // Paper - move down to make death event cancellable - this is the awardKillScore below
if (this.deathScore >= 0 && entityliving != null) {
entityliving.awardKillScore(this, this.deathScore, damageSource);
@@ -132,7 +131,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (world instanceof ServerLevel) {
ServerLevel worldserver = (ServerLevel) world;
+ // Paper - move below into if for onKill
+
- if (entity == null || entity.killedEntity(worldserver, this)) {
+ // Paper start
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(damageSource);
+ if (deathEvent == null || !deathEvent.isCancelled()) {
@@ -147,8 +147,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.clearedEquipmentSlots.clear();
+ }
+ // Paper end
- if (entity == null || entity.killedEntity(worldserver, this)) {
+
+ if (this.isSleeping()) {
+ this.stopSleeping();
+ }