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-02-25 20:01:14 +01:00
|
|
|
import java.io.PrintStream;
|
2011-02-25 17:12:38 +01:00
|
|
|
import java.util.logging.Level;
|
|
|
|
import java.util.logging.Logger;
|
|
|
|
import jline.ConsoleReader;
|
|
|
|
|
|
|
|
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() {
|
|
|
|
// Craftbukkit start - whole method, nuked to oblivion! :o
|
|
|
|
|
|
|
|
try {
|
2011-04-20 19:05:14 +02:00
|
|
|
ConsoleReader reader = this.server.reader;
|
2011-02-25 17:12:38 +01:00
|
|
|
String line = null;
|
2011-04-20 19:05:14 +02:00
|
|
|
while ((!this.server.isStopped) && (MinecraftServer.isRunning(this.server)) && ((line = reader.readLine(">", null)) != null)) {
|
|
|
|
this.server.issueCommand(line, (ICommandListener) this.server);
|
2011-02-25 17:12:38 +01:00
|
|
|
}
|
2011-04-20 19:05:14 +02:00
|
|
|
} catch (IOException ioexception) {
|
|
|
|
Logger.getLogger(ThreadCommandReader.class.getName()).log(Level.SEVERE, null, ioexception);
|
2011-02-25 17:12:38 +01:00
|
|
|
}
|
|
|
|
// Craftbukkit end
|
|
|
|
}
|
|
|
|
}
|