From fa7bf2d3dc90e5981090e768affb5bb4db093c5e Mon Sep 17 00:00:00 2001 From: Malfrador Date: Wed, 7 Jul 2021 15:15:17 +0200 Subject: [PATCH] Add option for logging named entity deaths (#6107) --- ...ption-for-named-entity-death-logging.patch | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 patches/server/Config-option-for-named-entity-death-logging.patch diff --git a/patches/server/Config-option-for-named-entity-death-logging.patch b/patches/server/Config-option-for-named-entity-death-logging.patch new file mode 100644 index 0000000000..c74a77862b --- /dev/null +++ b/patches/server/Config-option-for-named-entity-death-logging.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Malfrador +Date: Wed, 7 Jul 2021 12:48:50 +0200 +Subject: [PATCH] Config option for named entity death logging + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -0,0 +0,0 @@ public class PaperConfig { + deobfuscateStacktraces = getBoolean("settings.loggers.deobfuscate-stacktraces", deobfuscateStacktraces); + } + ++ public static boolean logNamedEntityDeaths = true; ++ private static void namedEntityDeaths() { ++ logNamedEntityDeaths = getBoolean("settings.log-named-entity-deaths", logNamedEntityDeaths); ++ } ++ + public static int itemValidationDisplayNameLength = 8192; + public static int itemValidationLocNameLength = 8192; + public static int itemValidationLoreLineLength = 8192; +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { + this.stopSleeping(); + } + +- if (!this.level.isClientSide && this.hasCustomName()) { ++ if (com.destroystokyo.paper.PaperConfig.logNamedEntityDeaths && !this.level.isClientSide && this.hasCustomName()) { // Paper - add setting for entity death logging + LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); + } +