Add TameableDeathMessageEvent

This commit is contained in:
Owen1212055 2021-06-21 21:24:45 -04:00
parent 30ccd487cf
commit 8f23a7f6af

View file

@ -31,7 +31,21 @@
}
return false;
@@ -295,7 +308,14 @@
@@ -244,7 +257,12 @@
if (entityliving instanceof ServerPlayer) {
ServerPlayer entityplayer = (ServerPlayer) entityliving;
- entityplayer.sendSystemMessage(this.getCombatTracker().getDeathMessage());
+ // Paper start - Add TameableDeathMessageEvent
+ io.papermc.paper.event.entity.TameableDeathMessageEvent event = new io.papermc.paper.event.entity.TameableDeathMessageEvent((org.bukkit.entity.Tameable) getBukkitEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getCombatTracker().getDeathMessage()));
+ if (event.callEvent()) {
+ entityplayer.sendSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.deathMessage()));
+ }
+ // Paper end - Add TameableDeathMessageEvent
}
}
}
@@ -295,7 +313,14 @@
if (!this.canTeleportTo(new BlockPos(x, y, z))) {
return false;
} else {