Hi Guys,
I am building a BotManager so i can build some integration with my web-panel later on.
At the moment i got the basics running but having an issue with starting the OSBot client.
The client starts and even runs the script but the bufferedReader ends as soon OSBot Starts.
See code down-below:
package Services;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Test {
public Test()
{
System.out.println("Starting bot");
try {
List<String> command = new ArrayList<>();
Collections.addAll(command, "C:\\Program Files\\Java\\jdk1.8.0_261\\bin\\javaw.exe", "-jar");
Collections.addAll(command, "osbot 2.5.85.jar");
Collections.addAll(command, "-login", String.format("%s:%s", "account", "password"));
Collections.addAll(command, "-bot", String.format("%s:%s:%s", "test@gmail.com", "password", "0000"));
Collections.addAll(command, "-world", "335");
Collections.addAll(command, "-script", "TutorialIsland:test@gmail.com");
final ProcessBuilder processBuilder = new ProcessBuilder(command);
processBuilder.redirectErrorStream(true);
final Process process = processBuilder.start();
try (final InputStream inputStream = process.getInputStream();
final InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
final BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) {
String outputLine;
while ((outputLine = bufferedReader.readLine()) != null) {
outputLine = outputLine.trim();
System.out.println(outputLine);
}
System.out.println("Buffer ending? start failed?");
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
bufferReader output:
Starting bot
Starting local script with name: TutorialIsland
[DEBUG][07/26 07:50:47 PM]: Injected 2 field list filters
[DEBUG][07/26 07:50:47 PM]: Injected 2 field filters
[DEBUG][07/26 07:50:47 PM]: Injected 2 method list filters
[DEBUG][07/26 07:50:47 PM]: Injected 3 method filters
Buffer ending? start failed?
Hope someone knows what's going wrong
Thanks!
Sincerely Dennis