0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/spigot.git synced 2024-11-24 12:56:24 +00:00
spigot/CraftBukkit-Patches/0072-Add-log-villager-deaths-option.patch
2024-10-23 02:15:00 +11:00

52 lines
2.7 KiB
Diff

From 10451ed51cd7b3a85a6f56352ef1a31f48fc9668 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sat, 14 Dec 2019 10:26:52 +1100
Subject: [PATCH] Add log-villager-deaths option
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
index effffbcacd..82c156665c 100644
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
@@ -1733,7 +1733,7 @@ public abstract class EntityLiving extends Entity implements Attackable {
}
if (!this.level().isClientSide && this.hasCustomName()) {
- EntityLiving.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString());
+ if (org.spigotmc.SpigotConfig.logNamedDeaths) EntityLiving.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot
}
this.dead = true;
diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java
index c288513263..7c5aff2fd2 100644
--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java
@@ -650,7 +650,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
@Override
public void die(DamageSource damagesource) {
- EntityVillager.LOGGER.info("Villager {} died, message: '{}'", this, damagesource.getLocalizedDeathMessage(this).getString());
+ if (org.spigotmc.SpigotConfig.logVillagerDeaths) EntityVillager.LOGGER.info("Villager {} died, message: '{}'", this, damagesource.getLocalizedDeathMessage(this).getString()); // Spigot
Entity entity = damagesource.getEntity();
if (entity != null) {
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index c17d581422..6502572f51 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -389,4 +389,11 @@ public class SpigotConfig
disableAdvancementSaving = getBoolean("advancements.disable-saving", false);
disabledAdvancements = getList("advancements.disabled", Arrays.asList(new String[]{"minecraft:story/disabled"}));
}
+
+ public static boolean logVillagerDeaths;
+ public static boolean logNamedDeaths;
+ private static void logDeaths() {
+ logVillagerDeaths = getBoolean("settings.log-villager-deaths", true);
+ logNamedDeaths = getBoolean("settings.log-named-deaths", true);
+ }
}
--
2.47.0