From e26d8346bd164261d96461fb5360fb826216bfaf Mon Sep 17 00:00:00 2001 From: Minecrell Date: Wed, 14 Jun 2017 09:31:44 +0200 Subject: [PATCH] Continue reading from console input after EOT There is usually no reason to stop reading from the console, so preventing console input after EOT can be extremely confusing. To prevent this, we can simply ignore the exception thrown by JLine and continue reading normally. --- ...inalConsoleAppender-for-console-improvements.patch | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch b/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch index 003fdbbfe5..eb3ea8d558 100644 --- a/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch @@ -115,7 +115,7 @@ index 00000000..24f30efb +} diff --git a/src/main/java/com/destroystokyo/paper/console/TerminalHandler.java b/src/main/java/com/destroystokyo/paper/console/TerminalHandler.java new file mode 100644 -index 00000000..dcd31fbc +index 00000000..d5bc6149 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/console/TerminalHandler.java @@ -0,0 +0,0 @@ @@ -124,6 +124,7 @@ index 00000000..dcd31fbc +import net.minecraft.server.DedicatedServer; +import net.minecrell.terminalconsole.TerminalConsoleAppender; +import org.bukkit.craftbukkit.command.ConsoleCommandCompleter; ++import org.jline.reader.EndOfFileException; +import org.jline.reader.LineReader; +import org.jline.reader.LineReaderBuilder; +import org.jline.reader.UserInterruptException; @@ -152,7 +153,13 @@ index 00000000..dcd31fbc + try { + String line; + while (!server.isStopped() && server.isRunning()) { -+ line = reader.readLine("> "); ++ try { ++ line = reader.readLine("> "); ++ } catch (EndOfFileException ignored) { ++ // Continue reading after EOT ++ continue; ++ } ++ + if (line == null) { + break; + }