All pastes #418788 Raw Edit

Untitled

public java v1 · immutable
#418788 ·published 2007-03-31 20:50 UTC
rendered paste body
public void run() {    	Handler handlers[] = HandlerStorage.handlers;        boolean changing = false;        for (int i = 0; i <handlers.length; i++) {            if (handlers[i].isChanging) {                changing = true;                break;            }        }        if (!changing) {            for (int i = 0; i < HandlerStorage.handlers.length; i++) {                int status = handlers[i].getStatus();                if (status == HandlerCore.RUNNING) {                    if (handlers[i].isTimeUp()) {                        handlers[i].deactivate();                        handlers[i].setProgressBar(0);                        handlers[i].setStatusMessage("Time is up");                    } else if (handlers[i].isScriptRunning()) {                        if (handlers[i].theBot != null                                && handlers[i].theBot.getCoreScriptManager() != null) {                            if (handlers[i].theBot.getCoreScriptManager().arg != handlers[i].ScriptArgs                                    || handlers[i].theBot                                            .getCoreScriptManager().name != handlers[i].Script                                    || handlers[i].theBot                                            .getCoreScriptManager().cmd != handlers[i].ScriptCmd) {                                handlers[i].theBot.getCoreScriptManager()                                        .stopScript();                                handlers[i].startScript();                            }                        }                    } else if (!handlers[i].isScriptRunning()) {                        if (handlers[i].ScriptWasStarted) {                            if (handlers[i].killOnScriptDeath()) {                                handlers[i].deactivate();                            }                            handlers[i].setProgressBar(0);                            handlers[i].setStatusMessage("Script died");                        } else {                            handlers[i].startScript();                        }                    }                }            }            int currentlyRunning = 0;            int currentlyNotRunning = 0;            for (int i = 0; i < handlers.length; i++) {                int status = handlers[i].getStatus();                if (status == HandlerCore.RUNNING) {                    currentlyRunning++;                } else if (status == HandlerCore.WAITING) {                    currentlyNotRunning++;                }            }            if (currentlyRunning < slots && currentlyNotRunning > 0) {                boolean mod = false;                for (int i = 0; currentlyRunning < slots && i < handlers.length; i++) {                    int status = handlers[i].getStatus();                    if (status == HandlerCore.WAITING) {                        handlers[i].activate();                        currentlyRunning++;                        mod = true;                    }                }                if (mod)                    update();            }        }        count++;        if (count > 3) {            for (int i = 0; i < handlers.length; i++) {                handlers[i].updateHandlerSettings();            }            count = 0;        }    }