2011-02-25 17:12:38 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
import java.io.BufferedReader;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStreamReader;
|
2011-04-20 22:47:26 +02:00
|
|
|
|
2012-07-22 08:18:00 +02:00
|
|
|
import static org.bukkit.craftbukkit.Main.*; // CraftBukkit
|
2011-11-05 21:14:26 +01:00
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
class ThreadCommandReader extends Thread {
|
2011-02-25 17:12:38 +01:00
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
final DedicatedServer server;
|
2011-02-25 17:12:38 +01:00
|
|
|
|
2013-11-04 14:07:38 +01:00
|
|
|
ThreadCommandReader(DedicatedServer dedicatedserver, String s) {
|
|
|
|
super(s);
|
2012-07-29 09:33:13 +02:00
|
|
|
this.server = dedicatedserver;
|
2011-02-25 17:12:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void run() {
|
2011-11-05 21:14:26 +01:00
|
|
|
// CraftBukkit start
|
|
|
|
if (!useConsole) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
|
2012-03-14 21:59:14 +01:00
|
|
|
jline.console.ConsoleReader bufferedreader = this.server.reader; // CraftBukkit
|
2012-07-29 09:33:13 +02:00
|
|
|
String s;
|
2011-02-25 17:12:38 +01:00
|
|
|
|
|
|
|
try {
|
2011-05-28 22:50:08 +02:00
|
|
|
// CraftBukkit start - JLine disabling compatibility
|
2012-07-29 09:33:13 +02:00
|
|
|
while (!this.server.isStopped() && this.server.isRunning()) {
|
2011-11-05 21:14:26 +01:00
|
|
|
if (useJline) {
|
2011-05-18 21:23:27 +02:00
|
|
|
s = bufferedreader.readLine(">", null);
|
2011-05-19 22:46:47 +02:00
|
|
|
} else {
|
|
|
|
s = bufferedreader.readLine();
|
2011-05-18 21:23:27 +02:00
|
|
|
}
|
|
|
|
if (s != null) {
|
|
|
|
this.server.issueCommand(s, this.server);
|
|
|
|
}
|
2011-06-27 00:25:01 +02:00
|
|
|
// CraftBukkit end
|
2011-02-25 17:12:38 +01:00
|
|
|
}
|
2011-04-20 19:05:14 +02:00
|
|
|
} catch (IOException ioexception) {
|
2013-11-04 14:07:38 +01:00
|
|
|
DedicatedServer.az().error("Exception handling console input", ioexception);
|
2011-02-25 17:12:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|