13
0
geforkt von Mirrors/Paper

Call entity_die game event after event cancel check (#10096)

Dieser Commit ist enthalten in:
Jake Potrebic 2023-12-29 11:57:32 -08:00
Ursprung c4e0d81696
Commit e1faa8e814
2 geänderte Dateien mit 11 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -34,6 +34,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start
public String displayName;
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
@Override
public void die(DamageSource damageSource) {
- this.gameEvent(GameEvent.ENTITY_DIE);
+ // this.gameEvent(GameEvent.ENTITY_DIE); // Paper - move below event cancellation check
boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
// CraftBukkit start - fire PlayerDeathEvent
if (this.isRemoved()) {
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
String deathmessage = defaultMessage.getString();
this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel
org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, PaperAdventure.asAdventure(defaultMessage), defaultMessage.getString(), keepInventory); // Paper - Adventure
@ -45,6 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ return;
+ }
+ this.gameEvent(GameEvent.ENTITY_DIE); // moved from the top of this method
+ // Paper end
// SPIGOT-943 - only call if they have an inventory open

Datei anzeigen

@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
@Override
public void die(DamageSource damageSource) {
this.gameEvent(GameEvent.ENTITY_DIE);
// this.gameEvent(GameEvent.ENTITY_DIE); // Paper - move below event cancellation check
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
this.dropExperience();
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.