mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
68 lines
2.7 KiB
Diff
68 lines
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 002511a54565aab9eb4552fecdf974fe0eab9122..7c9f7aefc59ae1a785b261f80f25d3304f3bdd22 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1026,6 +1026,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 - move final shutdown items here
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
index 37faa5ce82ae9ca2893250d86cc2eb21c00cc81f..39f361e2d3b31dc2587042df225132884a9156c0 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
@@ -18,6 +18,12 @@ public class Main {
|
|
public static boolean useJline = true;
|
|
public static boolean useConsole = true;
|
|
|
|
+ // Paper start - Reset loggers after shutdown
|
|
+ static {
|
|
+ System.setProperty("java.util.logging.manager", "io.papermc.paper.log.CustomLogManager");
|
|
+ }
|
|
+ // Paper end - Reset loggers after shutdown
|
|
+
|
|
public static void main(String[] args) {
|
|
// Paper start
|
|
final String warnWhenLegacyFormattingDetected = String.join(".", "net", "kyori", "adventure", "text", "warnWhenLegacyFormattingDetected");
|