aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0677-Add-TameableDeathMessageEvent.patch
blob: 641b0b0e37575dd90b0c6ecbb0dc46d1eb6e3821 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
index cd565d1a8dab8d45196e4d29cab3d93a3ca619eb..749ae54ee42229cb32ec5280bc59a88f74fde197 100644
--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java
+++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
@@ -250,7 +250,12 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
                 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
                 }
             }
         }