SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     private int startAccount(String bot, String osbotLogin, String script, String proxy, int world, String extraParams)
  2.             throws IOException, InterruptedException {
  3.         int processID = -1;
  4.  
  5.         String java = System.getProperty("os.name").contains("Linux") ? "/usr/bin/java -jar OSBot.jar "
  6.                 : "java -jar " + OptionMenu.OSBOT_WINDOWS_LOCATION + " ";
  7.         String botCommand = java + "-login " + OSBOTLOGIN + " -bot " + bot + " -script " + script + " -world " + world
  8.                 + (extraParams != null ? " " + extraParams : "");
  9.         if (proxy != null)
  10.             botCommand += " -proxy " + proxy;
  11.         botCommand += " -mem 900";
  12.  
  13.         System.out.println(botCommand.replace(osbotLogin, "PASSWORD"));
  14.  
  15.         Process pr = rt.exec(botCommand);
  16.         BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
  17.         String line;
  18.         List<Integer> pids = ProcessManager.getJavaPIDs();
  19.  
  20.         while ((line = input.readLine()) != null) {
  21.             System.out.println(line);
  22.             long start = System.currentTimeMillis();
  23.             boolean stop = false;
  24.             while (!stop && System.currentTimeMillis() - start < 60000) {
  25.                 try {
  26.                     Thread.sleep(250);
  27.                 } catch (InterruptedException e1) {
  28.                     e1.printStackTrace();
  29.                 }
  30.                 List<Integer> newPids = ProcessManager.getJavaPIDs();
  31.                 newPids.removeAll(pids);
  32.                 if (newPids.size() > 0) {
  33.                     for (int pid : newPids) {
  34.                         System.out.println(pid);
  35.                         System.out.println("Found new PID " + pid);
  36.                         processID = pid;
  37.                         stop = true;
  38.                     }
  39.                 }
  40.                 pids.addAll(newPids);
  41.             }
  42.             break;
  43.         }
  44.         return processID;
  45.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top