102 lines
7.3 KiB
Diff
102 lines
7.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Sat, 19 Oct 2019 00:52:12 -0500
|
|
Subject: [PATCH] Logger settings (suppressing pointless logs)
|
|
|
|
Original code by PurpurMC, licensed under MIT
|
|
You can find the original code on https://github.com/PurpurMC/Purpur
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
|
index a0c19503aabab5378d672a30163d35a5ba05b6c1..f70be47882fb05e34e672e2c0c4b64f9d3f901a1 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
|
@@ -183,6 +183,7 @@ public class PlayerAdvancements {
|
|
if (advancement == null) {
|
|
// CraftBukkit start
|
|
if (entry.getKey().getNamespace().equals("minecraft")) {
|
|
+ if (!wtf.etil.mirai.MiraiConfig.loggerSuppressIgnoredAdvancementWarnings) // Purpur
|
|
PlayerAdvancements.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.file);
|
|
}
|
|
// CraftBukkit end
|
|
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
|
index 80c1e0e47818486a68e0114b063395290365346b..365ede275df6b3b4da7075f29699ca7411b81f6d 100644
|
|
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
|
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
|
@@ -295,6 +295,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
|
return true;
|
|
} else {
|
|
// Paper start
|
|
+ if (!wtf.etil.mirai.MiraiConfig.loggerSuppressSetBlockFarChunk) // Purpur
|
|
if (!hasSetFarWarned) {
|
|
Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + pos + ", status: " + this.generatingStatus + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
|
|
hasSetFarWarned = true;
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 7846ce8a78a560855d7e2263db656143ea12e3f8..7bf8ade4c9907c0dc060b318c34cb43f7f9078c5 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -2577,6 +2577,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
return false;
|
|
} else {
|
|
if (message.hasExpiredServer(Instant.now())) {
|
|
+ if (!wtf.etil.mirai.MiraiConfig.loggerSuppressSentExpiredChat) // Purpur
|
|
ServerGamePacketListenerImpl.LOGGER.warn("{} sent expired chat: '{}'. Is the client/server system time unsynchronized? c: {} s: {}", this.player.getName().getString(), message.signedContent().plain(), message.timeStamp().getEpochSecond(), Instant.now().getEpochSecond()); // Paper
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/stats/ServerRecipeBook.java b/src/main/java/net/minecraft/stats/ServerRecipeBook.java
|
|
index d13ed3069e944d138442ea440ac3eaf8d44c18d3..c19367bdad3997aa7aac609762f9cf731433adfc 100644
|
|
--- a/src/main/java/net/minecraft/stats/ServerRecipeBook.java
|
|
+++ b/src/main/java/net/minecraft/stats/ServerRecipeBook.java
|
|
@@ -122,6 +122,7 @@ public class ServerRecipeBook extends RecipeBook {
|
|
Optional<? extends Recipe<?>> optional = recipeManager.byKey(minecraftkey);
|
|
|
|
if (!optional.isPresent()) {
|
|
+ if (!wtf.etil.mirai.MiraiConfig.loggerSuppressUnrecognizedRecipeErrors) // Purpur
|
|
ServerRecipeBook.LOGGER.error("Tried to load unrecognized recipe: {} removed now.", minecraftkey);
|
|
} else {
|
|
handler.accept((Recipe) optional.get());
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
|
|
index b2a15c986c7500a0ce227a54cb61ec3f5378f6f3..d243af83f3159d8a4d56d08dab022b317cc5687e 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
|
|
@@ -255,6 +255,7 @@ public final class CraftLegacy {
|
|
}
|
|
|
|
static {
|
|
+ if (!wtf.etil.mirai.MiraiConfig.loggerSuppressInitLegacyMaterialError) // Purpur
|
|
System.err.println("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!");
|
|
if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDebugging()) {
|
|
new Exception().printStackTrace();
|
|
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
|
index eda02eabbdb3c8d2cfe8c524fe9f5dfcca1089d8..375a56a4fe9d1a2d32f3db32c09341d249557342 100644
|
|
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
|
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
|
@@ -166,4 +166,27 @@ public class MiraiConfig {
|
|
"This can drastically reduce players timeouts due to a bad connection.");
|
|
}
|
|
|
|
+ public static boolean loggerSuppressInitLegacyMaterialError;
|
|
+ public static boolean loggerSuppressIgnoredAdvancementWarnings;
|
|
+ public static boolean loggerSuppressUnrecognizedRecipeErrors;
|
|
+ public static boolean loggerSuppressSetBlockFarChunk;
|
|
+ public static boolean loggerSuppressSentExpiredChat;
|
|
+ private static void loggerSettings() {
|
|
+ loggerSuppressInitLegacyMaterialError = getBoolean("logger.suppress-init-legacy-material-errors", false,
|
|
+ "Whether or not server should stop saying",
|
|
+ "'Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!'");
|
|
+ loggerSuppressIgnoredAdvancementWarnings = getBoolean("logger.suppress-ignored-advancement-warnings", false,
|
|
+ "Whether or not server should stop saying",
|
|
+ "'Ignored advancement '{}' in progress file {} - it doesn't exist anymore?'");
|
|
+ loggerSuppressUnrecognizedRecipeErrors = getBoolean("logger.suppress-unrecognized-recipe-errors", false,
|
|
+ "Whether or not server should stop saying",
|
|
+ "'Tried to load unrecognized recipe: {} removed now.'");
|
|
+ loggerSuppressSetBlockFarChunk = getBoolean("logger.suppress-setblock-in-far-chunk-errors", false,
|
|
+ "Whether or not server should stop saying",
|
|
+ "'Detected setBlock in a far chunk.'");
|
|
+ loggerSuppressSentExpiredChat = getBoolean("logger.suppress-sent-expired-chat", false,
|
|
+ "Whether or not server should stop saying",
|
|
+ "'{} sent expired chat: '{}'. Is the client/server system time unsynchronized?'");
|
|
+ }
|
|
+
|
|
}
|
|
\ No newline at end of file
|