Skip to content

Commit

Permalink
Fix TerminalConsoleAppender NPE error on server closed
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Dec 26, 2023
1 parent f5ff8da commit 223fdf3
Showing 1 changed file with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Tue, 26 Dec 2023 02:04:01 -0500
Subject: [PATCH] Fix TerminalConsoleAppender NPE error on server closed


diff --git a/build.gradle.kts b/build.gradle.kts
index 3d2439e90e1cb97b9b2c26c03f1dd03d5fd37552..3eaf0bb6022f5891e643060be47a86c6240dc07a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -37,7 +37,7 @@ dependencies {
// Gale end - project setup
// Paper start
implementation("org.jline:jline-terminal-jansi:3.24.1") // Leaf - Bump Dependencies
- implementation("net.minecrell:terminalconsoleappender:1.3.0")
+ implementation("com.github.Dreeam-qwq:TerminalConsoleAppender:af5a442f") // Leaf - Fix TerminalConsoleAppender NPE error on server closed
implementation("net.kyori:adventure-text-serializer-ansi:4.14.0") // Keep in sync with adventureVersion from Paper-API build file
implementation("net.kyori:ansi:1.0.3") // Manually bump beyond above transitive dep
/*
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 625822b060683bfdf3b79f82ed5eea68ff8ade85..fb3bbe36c7bf67be65f0978ead2d4c778c32ba82 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1276,10 +1276,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

//org.spigotmc.WatchdogThread.doStop(); // Spigot // Paper - move into stop
// CraftBukkit start - Restore terminal to original settings
- try {
+ // Leaf - Remove empty try catch
+ //try {
//net.minecrell.terminalconsole.TerminalConsoleAppender.close(); // Paper - Move into stop
- } catch (Exception ignored) {
- }
+ //} catch (Exception ignored) {
+ //}
+ // Leaf end
// CraftBukkit end
//this.onServerExit(); // Paper - moved into stop
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
index e8e93538dfd71de86515d9405f728db1631e949a..ff2f6535754598857a442ecc0ce5b70521810ad6 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
@@ -31,10 +31,12 @@ public class ServerShutdownThread extends Thread {
// Paper end
} finally {
org.apache.logging.log4j.LogManager.shutdown(); // Paper
- try {
+ // Leaf - Remove empty try catch
+ //try {
//net.minecrell.terminalconsole.TerminalConsoleAppender.close(); // Paper - Move into stop
- } catch (Exception e) {
- }
+ //} catch (Exception e) {
+ //}
+ // Leaf end
}
}
}

0 comments on commit 223fdf3

Please sign in to comment.