Jump to content

Starting OSBot client with java


Recommended Posts

Posted

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 :D

Thanks!

Sincerely Dennis

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...