private long calcNextSpawnTime() { if (config != null) { return penguin.getLastSpawnTime() + config.getTime(); } return Long.MAX_VALUE; }
@Override public boolean update() { if (config != null) { boolean isSpawnOK = Math.random() < config.getRate(); if (isSpawnOK) { this.lastSpawnedItem = config.getItem(); cote.Items.addEgg(lastSpawnedItem); } else { this.lastSpawnedItem = null; } penguin.setLastSpawnTime(nextSpawnTime); this.updateConfig(); this.nextSpawnTime = calcNextSpawnTime(); return true; } return false; }