9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0031-Do-not-log-invalid-statistics.patch

41 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Thu, 24 Nov 2022 23:39:32 +0100
Subject: [PATCH] Do not log invalid statistics
License: MIT (https://opensource.org/licenses/MIT)
Gale - https://galemc.org
This patch is based on the following patch:
"Ignore statistics warnings"
By: Aikar <aikar@aikar.co>
As part of: EmpireCraft (https://github.com/starlis/empirecraft)
Licensed under: MIT (https://opensource.org/licenses/MIT)
diff --git a/net/minecraft/stats/ServerStatsCounter.java b/net/minecraft/stats/ServerStatsCounter.java
index b147df7479da03fae19294587cded62c210ea590..dfaead7716ac718bcdbf4c3021aed1b57676af50 100644
--- a/net/minecraft/stats/ServerStatsCounter.java
+++ b/net/minecraft/stats/ServerStatsCounter.java
@@ -117,16 +117,18 @@ public class ServerStatsCounter extends StatsCounter {
this.stats
.putAll(
STATS_CODEC.parse(dynamic.get("stats").orElseEmptyMap())
- .resultOrPartial(string -> LOGGER.error("Failed to parse statistics for {}: {}", this.file, string))
+ .resultOrPartial(string -> {
+ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.invalidStatistics) LOGGER.error("Failed to parse statistics for {}: {}", this.file, string); // Gale - EMC - do not log invalid statistics
+ })
.orElse(Map.of())
);
return;
}
- LOGGER.error("Unable to parse Stat data from {}", this.file);
+ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.invalidStatistics) LOGGER.error("Unable to parse Stat data from {}", this.file); // Gale - EMC - do not log invalid statistics
}
} catch (IOException | JsonParseException var8) {
- LOGGER.error("Unable to parse Stat data from {}", this.file, var8);
+ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.invalidStatistics) LOGGER.error("Unable to parse Stat data from {}", this.file, var8); // Gale - EMC - do not log invalid statistics
}
}