Search in sources :

Example 1 with CustomBossesConfigFields

use of com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields in project EliteMobs by MagmaGuy.

the class RegionalBossEntity method save.

public static void save() {
    for (CustomBossesConfigFields customBossesConfigFields : regionalBossesFromConfigFields.keySet()) {
        if (!customBossesConfigFields.isFilesOutOfSync())
            continue;
        customBossesConfigFields.setFilesOutOfSync(false);
        List<String> spawnLocations = new ArrayList<>();
        for (RegionalBossEntity regionalBossEntity : regionalBossesFromConfigFields.get(customBossesConfigFields)) spawnLocations.add(regionalBossEntity.rawString);
        customBossesConfigFields.getFileConfiguration().set("spawnLocations", spawnLocations);
        try {
            customBossesConfigFields.getFileConfiguration().save(customBossesConfigFields.getFile());
        } catch (Exception ex) {
            new WarningMessage("Failed to save respawn timer for " + customBossesConfigFields.getFileConfiguration().getName() + " !");
        }
    }
}
Also used : CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) ArrayList(java.util.ArrayList)

Example 2 with CustomBossesConfigFields

use of com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields in project EliteMobs by MagmaGuy.

the class TransitiveBlockCommand method processCommand.

public static TransitiveBlockCommand processCommand(Player player, String filename, String transitiveBlockType, boolean edit) {
    CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(filename);
    if (customBossesConfigFields == null) {
        player.sendMessage("Boss file isn't valid! Try again with a valid filename for your custom boss.");
        return null;
    }
    if (!customBossesConfigFields.isRegionalBoss()) {
        player.sendMessage(ChatColor.RED + "Boss file isn't for a regional boss! This feature only works for regional bosses.");
        player.sendMessage(ChatColor.GREEN + "Ignore this warning if you are setting blocks for a phase boss whose first phase is a regional boss!");
    }
    TransitiveBlockType tbt = null;
    try {
        tbt = TransitiveBlockType.valueOf(transitiveBlockType);
    } catch (Exception ex) {
        player.sendMessage("Not a valid transitive block type, use ON_SPAWN or ON_REMOVE !");
        return null;
    }
    if (activePlayers.containsKey(player)) {
        activePlayers.get(player).commitLocations();
        return null;
    } else
        return new TransitiveBlockCommand(player, customBossesConfigFields, tbt, edit);
}
Also used : CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields)

Example 3 with CustomBossesConfigFields

use of com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields in project EliteMobs by MagmaGuy.

the class CustomBossCommandHandler method addRelativeSpawnLocation.

public static void addRelativeSpawnLocation(Player player, String customBossConfigFieldsString, String minidungeonString) {
    Minidungeon minidungeon = Minidungeon.getMinidungeons().get(minidungeonString);
    if (minidungeon == null) {
        player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed to add relative location! Minidungeon is not valid!"));
        return;
    }
    CustomBossesConfigFields customBossesConfigFields = CustomBossesConfigFields.getRegionalElites().get(customBossConfigFieldsString);
    if (customBossesConfigFields == null)
        player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed to add relative location! Custom boss is not valid!"));
    else {
        Location safeSpawnLocation = autoSeekSafeSpawnLocation(player.getLocation());
        if (safeSpawnLocation == null)
            player.sendMessage("[EliteMobs] No safe spawn location found! Make sure the area is passable!");
        else
            minidungeon.initializeRelativeLocationAddition(customBossesConfigFields, safeSpawnLocation);
    }
}
Also used : CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) Minidungeon(com.magmaguy.elitemobs.dungeons.Minidungeon) Location(org.bukkit.Location) DebugBlockLocation(com.magmaguy.elitemobs.utils.DebugBlockLocation)

Example 4 with CustomBossesConfigFields

use of com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields in project EliteMobs by MagmaGuy.

the class CustomBossCommandHandler method setLeashRadius.

public static void setLeashRadius(String customBossConfigFieldsString, CommandSender commandSender, int leashRadius) {
    CustomBossesConfigFields customBossesConfigFields = CustomBossesConfigFields.getRegionalElites().get(customBossConfigFieldsString);
    if (customBossesConfigFields == null) {
        commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed set the leash radius! Was the boss a valid regional boss?"));
        return;
    }
    customBossesConfigFields.runtimeSetLeashRadius(leashRadius);
    for (RegionalBossEntity regionalBossEntity : RegionalBossEntity.getRegionalBossEntitySet()) if (customBossesConfigFields.getFilename().equals(regionalBossEntity.getCustomBossesConfigFields().getFilename()))
        regionalBossEntity.setLeashRadius(leashRadius);
}
Also used : CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) RegionalBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity)

Example 5 with CustomBossesConfigFields

use of com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields in project EliteMobs by MagmaGuy.

the class SpawnCommand method spawnCustomBossCommand.

public static void spawnCustomBossCommand(Player player, String fileName) {
    CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(fileName);
    if (customBossesConfigFields == null) {
        player.sendMessage("Filename " + fileName + " is not valid! Make sure you are writing the name of a configuration file in the custombosses folder!");
        return;
    }
    CustomBossEntity customBossEntity = new CustomBossEntity(customBossesConfigFields);
    customBossEntity.setSpawnLocation(getLocation(player));
    customBossEntity.spawn(false);
}
Also used : CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity)

Aggregations

CustomBossesConfigFields (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields)11 CustomBossEntity (com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity)5 WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)4 Location (org.bukkit.Location)4 RegionalBossEntity (com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity)2 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)2 ChatColorConverter (com.magmaguy.elitemobs.ChatColorConverter)1 MetadataHandler (com.magmaguy.elitemobs.MetadataHandler)1 NewMinidungeonRelativeBossLocationEvent (com.magmaguy.elitemobs.api.internal.NewMinidungeonRelativeBossLocationEvent)1 RemovalReason (com.magmaguy.elitemobs.api.internal.RemovalReason)1 CustomBossesConfig (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig)1 CustomTreasureChestConfigFields (com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestConfigFields)1 CustomTreasureChestsConfig (com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig)1 DungeonPackagerConfigFields (com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields)1 Minidungeon (com.magmaguy.elitemobs.dungeons.Minidungeon)1 MinidungeonWorldLoader (com.magmaguy.elitemobs.dungeons.worlds.MinidungeonWorldLoader)1 EntityTracker (com.magmaguy.elitemobs.entitytracker.EntityTracker)1 EliteEntity (com.magmaguy.elitemobs.mobconstructor.EliteEntity)1 GenericRotationMatrixMath (com.magmaguy.elitemobs.powerstances.GenericRotationMatrixMath)1 WorldGuardCompatibility (com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility)1