} catch (final ThreadDeath ignored) {
} catch (final Throwable ex) {
log.log(Level.SEVERE, "Error starting script: ", ex);
}
if (start) {
final BreakHandler breakHandler = new BreakHandler(this);
setRunning(true);
register();
log.info("Script started.");
try {
while (isRunning()) {
if (!isPaused()) {
if (AccountManager.isTakingBreaks(account.getName())) {
if (breakHandler.isBreaking()) {
if (System.currentTimeMillis() - lastNotice > 600000) {
lastNotice = System.currentTimeMillis();
log.info("Breaking for " + Timer.format(breakHandler.getBreakTime()));
}
if (game.isLoggedIn() && breakHandler.getBreakTime() > 60000) {
game.logout(true);
}
try {
sleep(5000);
} catch (final ThreadDeath td) {
break;
}
continue;
} else {
breakHandler.tick();
}
}
if (checkForRandoms()) {
continue;
}