geforkt von Mirrors/Paper
d5f1ffc2e6
With the new chunk system it doesn't hurt too much to (temporarily) remove this until implemented in a safer manner
68 Zeilen
2.7 KiB
Diff
68 Zeilen
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Jos=C3=A9=20Miguel=20Moreno?= <josemmo@pm.me>
|
|
Date: Sat, 5 Jun 2021 13:45:15 +0200
|
|
Subject: [PATCH] Fix plugin loggers on server shutdown
|
|
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/log/CustomLogManager.java b/src/main/java/io/papermc/paper/log/CustomLogManager.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..c1d3bac79bb8b4796c013ff4472f75dcd79602dc
|
|
--- /dev/null
|
|
+++ b/src/main/java/io/papermc/paper/log/CustomLogManager.java
|
|
@@ -0,0 +1,26 @@
|
|
+package io.papermc.paper.log;
|
|
+
|
|
+import java.util.logging.LogManager;
|
|
+
|
|
+public class CustomLogManager extends LogManager {
|
|
+ private static CustomLogManager instance;
|
|
+
|
|
+ public CustomLogManager() {
|
|
+ instance = this;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void reset() {
|
|
+ // Ignore calls to this method
|
|
+ }
|
|
+
|
|
+ private void superReset() {
|
|
+ super.reset();
|
|
+ }
|
|
+
|
|
+ public static void forceReset() {
|
|
+ if (instance != null) {
|
|
+ instance.superReset();
|
|
+ }
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 0e04083ff0598451c66731b1518b2eb6367ae36c..710ca7d3a5659953f64bc6dccdd93b43300961cc 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -998,6 +998,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
net.minecrell.terminalconsole.TerminalConsoleAppender.close(); // Paper - Use TerminalConsoleAppender
|
|
} catch (Exception e) {
|
|
}
|
|
+ io.papermc.paper.log.CustomLogManager.forceReset(); // Paper - Reset loggers after shutdown
|
|
this.onServerExit();
|
|
// Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
index 1176f77c79c2cbd727f1f6867e956fb698936349..119d9bb5e41038704654e248bf168d22af246b7f 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
@@ -20,6 +20,12 @@ public class Main {
|
|
public static boolean useJline = true;
|
|
public static boolean useConsole = true;
|
|
|
|
+ // Paper start - Hijack log manager to ensure logging on shutdown
|
|
+ static {
|
|
+ System.setProperty("java.util.logging.manager", "io.papermc.paper.log.CustomLogManager");
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
public static void main(String[] args) {
|
|
// Paper start
|
|
final String warnWhenLegacyFormattingDetected = String.join(".", "net", "kyori", "adventure", "text", "warnWhenLegacyFormattingDetected");
|