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
|
|
|
|
2011-11-05 21:14:26 +01:00
|
|
|
import static org.bukkit.craftbukkit.Main.*;
|
|
|
|
|
2011-02-25 17:12:38 +01:00
|
|
|
public class ThreadCommandReader extends Thread {
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
final MinecraftServer server;
|
2011-02-25 17:12:38 +01:00
|
|
|
|
|
|
|
public ThreadCommandReader(MinecraftServer minecraftserver) {
|
2011-04-20 19:05:14 +02:00
|
|
|
this.server = minecraftserver;
|
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
|
2011-05-14 16:29:42 +02:00
|
|
|
String s = null;
|
2011-02-25 17:12:38 +01:00
|
|
|
|
|
|
|
try {
|
2011-05-28 22:50:08 +02:00
|
|
|
// CraftBukkit start - JLine disabling compatibility
|
2011-05-18 21:23:27 +02:00
|
|
|
while (!this.server.isStopped && MinecraftServer.isRunning(this.server)) {
|
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) {
|
2011-05-14 16:29:42 +02:00
|
|
|
// CraftBukkit
|
2011-06-27 00:25:01 +02:00
|
|
|
java.util.logging.Logger.getLogger(ThreadCommandReader.class.getName()).log(java.util.logging.Level.SEVERE, null, ioexception);
|
2011-02-25 17:12:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|