Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
89d51d5f29
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
68 Zeilen
2.6 KiB
Diff
68 Zeilen
2.6 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 ab1f4e62b2ffed99b47ae23cae172f20ed586b27..97dbe5a44d2791c6dee830654c3935f4ac54aad4 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1223,6 +1223,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
} catch (Exception ignored) {
|
|
}
|
|
// CraftBukkit end
|
|
+ io.papermc.paper.log.CustomLogManager.forceReset(); // Paper - Reset loggers after shutdown
|
|
this.onServerExit();
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
index db6398c1822f6ad499feddd6a915984ef9917777..d931a4c6e633bf9c1b3e5e18e880e2ddbfe4aa2a 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");
|