Search in sources :

Example 1 with DebugMessage

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();
    }
}
Also used : GuildRank(com.magmaguy.elitemobs.adventurersguild.GuildRank) Setter(lombok.Setter) WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) Getter(lombok.Getter) CustomBossesConfig(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig) EliteMobs(com.magmaguy.elitemobs.EliteMobs) CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) DebugMessage(com.magmaguy.elitemobs.utils.DebugMessage) Player(org.bukkit.entity.Player) org.bukkit(org.bukkit) ArrayList(java.util.ArrayList) VersionChecker(com.magmaguy.elitemobs.utils.VersionChecker) PlayerData(com.magmaguy.elitemobs.playerdata.database.PlayerData) Block(org.bukkit.block.Block) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) MetadataHandler(com.magmaguy.elitemobs.MetadataHandler) TimedEvent(com.magmaguy.elitemobs.events.TimedEvent) WorldGuardFlagChecker(com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardFlagChecker) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) CustomSpawnConfig(com.magmaguy.elitemobs.config.customspawns.CustomSpawnConfig) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity) Vector(org.bukkit.util.Vector) Objects(java.util.Objects) MoonPhaseDetector(com.magmaguy.elitemobs.events.MoonPhaseDetector) List(java.util.List) CustomSpawnConfigFields(com.magmaguy.elitemobs.config.customspawns.CustomSpawnConfigFields) ValidWorldsConfig(com.magmaguy.elitemobs.config.ValidWorldsConfig) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) DebugMessage(com.magmaguy.elitemobs.utils.DebugMessage)

Aggregations

EliteMobs (com.magmaguy.elitemobs.EliteMobs)1 MetadataHandler (com.magmaguy.elitemobs.MetadataHandler)1 GuildRank (com.magmaguy.elitemobs.adventurersguild.GuildRank)1 ValidWorldsConfig (com.magmaguy.elitemobs.config.ValidWorldsConfig)1 CustomBossesConfig (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig)1 CustomBossesConfigFields (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields)1 CustomSpawnConfig (com.magmaguy.elitemobs.config.customspawns.CustomSpawnConfig)1 CustomSpawnConfigFields (com.magmaguy.elitemobs.config.customspawns.CustomSpawnConfigFields)1 MoonPhaseDetector (com.magmaguy.elitemobs.events.MoonPhaseDetector)1 TimedEvent (com.magmaguy.elitemobs.events.TimedEvent)1 CustomBossEntity (com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity)1 PlayerData (com.magmaguy.elitemobs.playerdata.database.PlayerData)1 WorldGuardFlagChecker (com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardFlagChecker)1 DebugMessage (com.magmaguy.elitemobs.utils.DebugMessage)1 VersionChecker (com.magmaguy.elitemobs.utils.VersionChecker)1 WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Objects (java.util.Objects)1 ThreadLocalRandom (java.util.concurrent.ThreadLocalRandom)1