Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private int startAccount(String bot, String osbotLogin, String script, String proxy, int world, String extraParams)
- throws IOException, InterruptedException {
- int processID = -1;
- String java = System.getProperty("os.name").contains("Linux") ? "/usr/bin/java -jar OSBot.jar "
- : "java -jar " + OptionMenu.OSBOT_WINDOWS_LOCATION + " ";
- String botCommand = java + "-login " + OSBOTLOGIN + " -bot " + bot + " -script " + script + " -world " + world
- + (extraParams != null ? " " + extraParams : "");
- if (proxy != null)
- botCommand += " -proxy " + proxy;
- botCommand += " -mem 900";
- System.out.println(botCommand.replace(osbotLogin, "PASSWORD"));
- Process pr = rt.exec(botCommand);
- BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
- String line;
- List<Integer> pids = ProcessManager.getJavaPIDs();
- while ((line = input.readLine()) != null) {
- System.out.println(line);
- long start = System.currentTimeMillis();
- boolean stop = false;
- while (!stop && System.currentTimeMillis() - start < 60000) {
- try {
- Thread.sleep(250);
- } catch (InterruptedException e1) {
- e1.printStackTrace();
- }
- List<Integer> newPids = ProcessManager.getJavaPIDs();
- newPids.removeAll(pids);
- if (newPids.size() > 0) {
- for (int pid : newPids) {
- System.out.println(pid);
- System.out.println("Found new PID " + pid);
- processID = pid;
- stop = true;
- }
- }
- pids.addAll(newPids);
- }
- break;
- }
- return processID;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement