blob: 02cbab44319c3ad689fe627d72fe4c43dda1d081 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
--- ../work/decompile-8eb82bde//net/minecraft/server/ThreadCommandReader.java 2014-11-28 17:43:43.385707429 +0000
+++ src/main/java/net/minecraft/server/ThreadCommandReader.java 2014-11-28 17:38:18.000000000 +0000
@@ -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);
|