summaryrefslogtreecommitdiffstats
path: root/nms-patches/ThreadCommandReader.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches/ThreadCommandReader.patch')
-rw-r--r--nms-patches/ThreadCommandReader.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/nms-patches/ThreadCommandReader.patch b/nms-patches/ThreadCommandReader.patch
new file mode 100644
index 00000000..87bf341a
--- /dev/null
+++ b/nms-patches/ThreadCommandReader.patch
@@ -0,0 +1,43 @@
+--- ../work/decompile-bb26c12b/net/minecraft/server/ThreadCommandReader.java 2014-11-27 08:59:46.897420984 +1100
++++ src/main/java/net/minecraft/server/ThreadCommandReader.java 2014-11-27 08:42:10.084851043 +1100
+@@ -4,6 +4,8 @@
+ import java.io.IOException;
+ import java.io.InputStreamReader;
+
++import static org.bukkit.craftbukkit.Main.*; // CraftBukkit
++
+ class ThreadCommandReader extends Thread {
+
+ final DedicatedServer server;
+@@ -14,13 +16,28 @@
+ }
+
+ public void run() {
+- BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in));
++ // CraftBukkit start
++ if (!useConsole) {
++ return;
++ }
++ // CraftBukkit end
++
++ jline.console.ConsoleReader bufferedreader = this.server.reader; // CraftBukkit
+
+ String s;
+
+ try {
+- while (!this.server.isStopped() && this.server.isRunning() && (s = bufferedreader.readLine()) != null) {
+- this.server.issueCommand(s, this.server);
++ // CraftBukkit start - JLine disabling compatibility
++ while (!this.server.isStopped() && this.server.isRunning()) {
++ if (useJline) {
++ s = bufferedreader.readLine(">", null);
++ } else {
++ s = bufferedreader.readLine();
++ }
++ if (s != null && s.trim().length() > 0) { // Trim to filter lines which are just spaces
++ this.server.issueCommand(s, this.server);
++ }
++ // CraftBukkit end
+ }
+ } catch (IOException ioexception) {
+ DedicatedServer.aR().error("Exception handling console input", ioexception);