All pastes #331270 Raw Edit

Mine

public text v1 · immutable
#331270 ·published 2007-01-28 18:42 UTC
rendered paste body
    private boolean waitUntilItem(int item, int timeOut) {
        long startTime = System.currentTimeMillis();
        int oldCount = getInventoryCount(item);
        while(true) {
            int newCount = getInventoryCount(item);
            long currentTime = System.currentTimeMillis();
            if(newCount > oldCount) return true;
            if(timeOut >= 0 && currentTime - startTime > timeOut) return false;
            wait(random(200, 300));
        }
    }