use of com.magmaguy.elitemobs.utils.DebugMessage in project EliteMobs by MagmaGuy.
the class CustomSpawn method generateCustomSpawn.
private void generateCustomSpawn() {
int maxTries = 100;
int tries = 0;
while (tries < maxTries && spawnLocation == null) {
if (!keepTrying)
return;
tries++;
allTries++;
this.spawnLocation = generateRandomSpawnLocation();
if (spawnLocation != null)
break;
}
if (spawnLocation == null) {
if (keepTrying) {
new BukkitRunnable() {
@Override
public void run() {
generateCustomSpawn();
if (timedEvent != null)
new DebugMessage("Failed to spawn " + timedEvent.getCustomEventsConfigFields().getFilename() + " after " + allTries + " tries. Will try again in 1 minute.");
}
}.runTaskLaterAsynchronously(MetadataHandler.PLUGIN, 20 * 60);
} else {
customBossEntities.forEach((customBossEntity -> {
if (customBossEntity.summoningEntity != null)
customBossEntity.summoningEntity.removeReinforcement(customBossEntity);
}));
}
} else {
if (isEvent)
new DebugMessage("Spawned bosses for event after " + allTries + " tries");
spawn();
}
}
Aggregations