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
|
|
|
|
|
|
|
// CraftBukkit start
|
2011-02-25 17:12:38 +01:00
|
|
|
import java.util.logging.Level;
|
|
|
|
import java.util.logging.Logger;
|
|
|
|
import jline.ConsoleReader;
|
2011-04-20 22:47:26 +02:00
|
|
|
// CraftBukkit end
|
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-05-18 21:23:27 +02:00
|
|
|
// CraftBukkit start
|
2011-05-14 16:29:42 +02:00
|
|
|
ConsoleReader bufferedreader = this.server.reader;
|
|
|
|
String s = null;
|
2011-05-18 21:23:27 +02:00
|
|
|
String jlineTerminalSetting = org.bukkit.craftbukkit.Main.jlineTerminalSetting;
|
|
|
|
// CraftBukkit end
|
2011-02-25 17:12:38 +01:00
|
|
|
|
|
|
|
try {
|
2011-05-18 21:23:27 +02:00
|
|
|
while (!this.server.isStopped && MinecraftServer.isRunning(this.server)) {
|
|
|
|
// CraftBukkit start - JLine disabling compatibility
|
|
|
|
if (jlineTerminalSetting != null && jlineTerminalSetting.equals("jline.UnsupportedTerminal")) {
|
|
|
|
s = bufferedreader.readLine();
|
|
|
|
} else {
|
|
|
|
s = bufferedreader.readLine(">", null);
|
|
|
|
}
|
|
|
|
if (s != null) {
|
|
|
|
// CraftBukkit end
|
|
|
|
this.server.issueCommand(s, this.server);
|
|
|
|
}
|
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-04-20 19:05:14 +02:00
|
|
|
Logger.getLogger(ThreadCommandReader.class.getName()).log(Level.SEVERE, null, ioexception);
|
2011-02-25 17:12:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|