I've got an issue sending commands to a Bukkit server for Minecraft. My code work perfectly for Vanilla but when I try it with Bukkit it doesn't seem to want to work any longer. I still can receive all the output from the server I just can't send commands like "Help" or "Stop." This is my class for handling the server thread.
public class Sender{
ConsoleWriter cWriter = new ConsoleWriter();
private BufferedWriter writer;
private OutputStreamWriter out;
public void execute(){
this.ui = ui;
try{
ProcessBuilder pb = new ProcessBuilder(path_to_server+"launch.bat");
Process process = pb.start();
StreamGobbler sgError = new StreamGobbler(process.getErrorStream());
new Thread( sgError ).start();
out = new OutputStreamWriter(process.getOutputStream());
writer = new PrintWriter(out);
} catch ( IOException e ){
e.printStackTrace();
}
}
private class StreamGobbler implements Runnable
{
private InputStream is;
public StreamGobbler( InputStream is ){
this.is = is;
}
@Override
public void run() {
try {
InputStreamReader isr = new InputStreamReader( is );
BufferedReader br = new BufferedReader( isr );
String line = null;
while ( ( line = br.readLine() ) != null ){
cWriter.writer(line, ui);
}
} catch ( IOException e ){
e.printStackTrace();
}
}
}
}
So what is going on here? why does it work fine for Vanilla but not Bukkit?
Thanks!