PaperMC/patches/server/0673-Add-TameableDeathMessageEvent.patch

25 lines
1.6 KiB
Diff
Raw Normal View History

2024-10-23 22:52:43 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Mon, 21 Jun 2021 21:24:45 -0400
Subject: [PATCH] Add TameableDeathMessageEvent
diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
2024-12-03 19:54:10 +01:00
index 45a340fddcec48dfb796f4515a500452adb30c59..1c195c928fb5c165981665393424a64004331c93 100644
2024-10-23 22:52:43 +02:00
--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java
+++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
2024-12-03 19:54:10 +01:00
@@ -257,7 +257,12 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
2024-10-23 22:52:43 +02:00
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()) {
2024-10-25 20:09:45 +02:00
+ entityplayer.sendSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.deathMessage()));
2024-10-23 22:52:43 +02:00
+ }
+ // Paper end - Add TameableDeathMessageEvent
}
}
}