Source:
public final void run() { Context context = Context.getInstance(); Core.verbose("Initializing script..."); context.getServerProvider().initScript(this); Core.verbose("Done."); if (!onExecute()) { Core.verbose("Script#onExecute returned false, unloading and stopping script..."); context.getServerProvider().unloadScript(this); this.state = STATE_STOPPED; Core.verbose("Done."); return; } context.getRandomHandler().runAll(RandomType.ON_SCRIPT_START); Core.verbose("Detecting script framework..."); context.setRunningScript(this); BotUI.getInstance().toggleRun(); if (this instanceof LoopTask) { Core.verbose("Script framework detected: LoopTask"); frameWorkType = TYPE_LOOP; frameWork = Frameworks.getLooper((LoopTask) this); } else if (strategies != null && !strategies.isEmpty()) { Core.verbose("Script framework detected: Strategies"); frameWorkType = TYPE_STRATEGY; frameWork = Frameworks.getStrategyWorker(strategies); } else { Core.verbose("Unknown script framework: Other"); frameWorkType = TYPE_OTHER; } Core.verbose("Running script..."); Logger.addMessage("Script started.", true); FileExceptionHandler scriptException = new FileExceptionHandler(ExceptionHandler.ExceptionType.SCRIPT); try { while (this.state != STATE_STOPPED) { if (context.getRandomHandler().checkAndRun(RandomType.SCRIPT)) { continue; } if (this.state == STATE_PAUSE) { sleep(500); continue; } if (!frameWork.execute()) { break; } } } catch (Throwable t) { scriptException.handle(t); t.printStackTrace(); } Core.verbose("Script stopped/finished, unloading and stopping..."); onFinish(); context.getRandomHandler().runAll(RandomType.ON_SCRIPT_FINISH); Logger.addMessage("Script stopped.", false); context.getServerProvider().unloadScript(this); this.state = STATE_STOPPED; context.setRunningScript(null); Core.verbose("Resetting key bindings..."); Context.getInstance().getPbKeyListener().resetBindings(); BotUI.getInstance().toggleRun(); Core.verbose("Done."); }

Target:
public final void run() { Context context = Context.getInstance(); Core.verbose("Initializing script..."); context.getServerProvider().initScript(this); Core.verbose("Done."); if (!onExecute()) { Core.verbose("Script#onExecute returned false, unloading and stopping script..."); context.getServerProvider().unloadScript(this); this.state = STATE_STOPPED; Core.verbose("Done."); return; } context.getRandomHandler().runAll(RandomType.ON_SCRIPT_START); Core.verbose("Detecting script framework..."); context.setRunningScript(this); BotUI.getInstance().toggleRun(); if (this instanceof LoopTask) { Core.verbose("Script framework detected: LoopTask"); frameWorkType = TYPE_LOOP; frameWork = Frameworks.getLooper((LoopTask) this); } else if (strategies != null && !strategies.isEmpty()) { Core.verbose("Script framework detected: Strategies"); frameWorkType = TYPE_STRATEGY; frameWork = Frameworks.getStrategyWorker(strategies); } else { Core.verbose("Unknown script framework: Other"); frameWorkType = TYPE_OTHER; } Core.verbose("Running script..."); Logger.addMessage("Script started.", true); try { while (this.state != STATE_STOPPED) { if (context.getRandomHandler().checkAndRun(RandomType.SCRIPT)) { continue; } if (this.state == STATE_PAUSE) { sleep(500); continue; } if (!frameWork.execute()) { break; } } } catch (Throwable t) { t.printStackTrace(); } Core.verbose("Script stopped/finished, unloading and stopping..."); onFinish(); context.getRandomHandler().runAll(RandomType.ON_SCRIPT_FINISH); Logger.addMessage("Script stopped.", false); context.getServerProvider().unloadScript(this); this.state = STATE_STOPPED; context.setRunningScript(null); Core.verbose("Resetting key bindings..."); Context.getInstance().getPbKeyListener().resetBindings(); BotUI.getInstance().toggleRun(); Core.verbose("Done."); }