Search in sources :

Example 1 with CustomBossesConfig

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

the class EliteMobs method onEnable.

@Override
public void onEnable() {
    Bukkit.getLogger().info(" _____ _     _____ _____ ________  ______________  _____");
    Bukkit.getLogger().info("|  ___| |   |_   _|_   _|  ___|  \\/  |  _  | ___ \\/  ___|");
    Bukkit.getLogger().info("| |__ | |     | |   | | | |__ | .  . | | | | |_/ /\\ `--.");
    Bukkit.getLogger().info("|  __|| |     | |   | | |  __|| |\\/| | | | | ___ \\ `--. \\");
    Bukkit.getLogger().info("| |___| |_____| |_  | | | |___| |  | \\ \\_/ / |_/ //\\__/ /");
    Bukkit.getLogger().info("\\____/\\_____/\\___/  \\_/ \\____/\\_|  |_/\\___/\\____/ \\____/");
    MetadataHandler.PLUGIN = this;
    Bukkit.getLogger().info("By MagmaGuy - v. " + MetadataHandler.PLUGIN.getDescription().getVersion());
    ServerTime.startTickCounter();
    if (Bukkit.getServer().spigot().getConfig().getDouble("settings.attribute.maxHealth.max") < 100000000) {
        Bukkit.getServer().spigot().getConfig().set("settings.attribute.maxHealth.max", 100000000);
        try {
            File spigotConfigContainer = new File(Paths.get(MetadataHandler.PLUGIN.getDataFolder().getParentFile().getCanonicalFile().getParentFile().toString() + "/spigot.yml").toString());
            Bukkit.getServer().spigot().getConfig().save(spigotConfigContainer);
            new InfoMessage("New default max health set correctly!");
        } catch (IOException e) {
            new WarningMessage("Failed to save max health value! For the plugin to work correctly, you should increase your max health on the spigot.yml config file to " + 100000000);
        }
    }
    // Remove entities that should not exist
    CrashFix.startupCheck();
    /*
        New config loading
         */
    initializeConfigs();
    if (Bukkit.getPluginManager().isPluginEnabled("LibsDisguises"))
        DisguiseEntity.initialize();
    if (worldGuardIsEnabled)
        Bukkit.getLogger().info("[EliteMobs] WorldGuard compatibility is enabled!");
    else
        Bukkit.getLogger().warning("[EliteMobs] WorldGuard compatibility is not enabled!");
    // Enable Vault
    try {
        VaultCompatibility.vaultSetup();
    } catch (Exception e) {
        Bukkit.getLogger().warning("[EliteMobs] Something went wrong with the vault configuration - your Vault " + "version is probably not compatible with this EliteMobs version. Please contact the dev about this error.");
        VaultCompatibility.VAULT_ENABLED = false;
    }
    // Hook up all listeners, some depend on config
    EventsRegistrer.registerEvents();
    // Launch the local data cache
    PlayerData.initializeDatabaseConnection();
    ElitePlayerInventory.initialize();
    // Get world list
    worldScanner();
    // Start the repeating tasks such as scanners
    launchRunnables();
    // launch events
    ActionEvent.initializeBlueprintEvents();
    TimedEvent.initializeBlueprintEvents();
    // launch internal clock for attack cooldown
    EliteMobDamagedByPlayerEvent.EliteMobDamagedByPlayerEventFilter.launchInternalClock();
    /*
        Initialize mob values
         */
    PluginMobProperties.initializePluginMobValues();
    /*
        Cache animation vectors
         */
    MinorPowerStanceMath.initializeVectorCache();
    MajorPowerStanceMath.initializeVectorCache();
    /*
        Scan for loaded SuperMobs
         */
    PassiveEliteMobDeathHandler.SuperMobScanner.scanSuperMobs();
    // Small check to make sure that PlaceholderAPI is installed
    if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
        Placeholders placeholders = new Placeholders();
        placeholders.register();
        this.placeholders = placeholders;
    }
    // Enable stats
    metrics = new Metrics(this, 1081);
    // Initialize custom charts
    new CustomCharts();
    // Imports custom configurations and mindungeons from the import folder
    ConfigurationImporter.initializeConfigs();
    ConfigurationExporter.initializeConfigs();
    // Import custom items after potentially importing new items
    new CustomItemsConfig();
    CustomItem.initializeCustomItems();
    LootTables.initialize();
    // Load minidungeons, most of all load the worlds of minidungeons
    new DungeonPackagerConfig();
    // Load Adventurer's Guild
    if (AdventurersGuildConfig.isGuildWorldIsEnabled()) {
        try {
            CustomWorldLoading.startupWorldInitialization();
            AdventurersGuildCommand.defineTeleportLocation();
            if (AdventurersGuildConfig.getGuildWorldLocation() == null)
                AdventurersGuildConfig.toggleGuildInstall();
        } catch (Exception e) {
            AdventurersGuildConfig.toggleGuildInstall();
            new WarningMessage("Failed to initialize the Adventurer's Guild Hub! It is now disabled. You can try to" + "reenable it in /em setup");
        }
    }
    // Load all regional bosses
    new CustomBossesConfig();
    new CustomTreasureChestsConfig();
    // Find the stats of bosses in minidungeons
    for (Minidungeon minidungeon : Minidungeon.getMinidungeons().values()) {
        if (minidungeon.getDungeonPackagerConfigFields().getDungeonLocationType() != null)
            if (minidungeon.getDungeonPackagerConfigFields().getDungeonLocationType().equals(DungeonPackagerConfigFields.DungeonLocationType.WORLD))
                minidungeon.quantifyWorldBosses();
            else if (minidungeon.getDungeonPackagerConfigFields().getDungeonLocationType().equals(DungeonPackagerConfigFields.DungeonLocationType.SCHEMATIC))
                minidungeon.quantifySchematicBosses(false);
    }
    // Initialize npcs
    new NPCsConfig();
    // Initialize custom spawn methods, this runs late because it compares loaded worlds against worlds listed in the config
    try {
        new CustomSpawnConfig();
    } catch (Exception ex) {
        new WarningMessage("You are using a version of Spigot or a branch thereof (Paper, Purpur, so on) that is (probably) HORRIBLY outdated!" + " This issue will probably be fixed if you update your server version to the latest patch of the version you are running.");
        new WarningMessage(" This does not mean that you have to update your Minecraft version, but it does mean you must update your server version to the latest patch" + " available for that Minecraft version. Download from trustworthy sources, as if you download Spigot from some random website other than Spigot," + " you are probably not getting the latest version (and also there's a high chance you'll get a virus).");
    }
    new CustomQuestsConfig();
    new WormholeConfig();
    // Commands
    new CommandHandler();
    /*
        Check for new plugin version or for dungeon updates
         */
    VersionChecker.check();
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) CustomItemsConfig(com.magmaguy.elitemobs.config.customitems.CustomItemsConfig) Minidungeon(com.magmaguy.elitemobs.dungeons.Minidungeon) CustomQuestsConfig(com.magmaguy.elitemobs.config.customquests.CustomQuestsConfig) CustomTreasureChestsConfig(com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig) IOException(java.io.IOException) CommandHandler(com.magmaguy.elitemobs.commands.CommandHandler) IOException(java.io.IOException) CustomCharts(com.magmaguy.elitemobs.thirdparty.bstats.CustomCharts) DungeonPackagerConfig(com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfig) WormholeConfig(com.magmaguy.elitemobs.config.wormholes.WormholeConfig) Metrics(org.bstats.bukkit.Metrics) Placeholders(com.magmaguy.elitemobs.thirdparty.placeholderapi.Placeholders) InfoMessage(com.magmaguy.elitemobs.utils.InfoMessage) NPCsConfig(com.magmaguy.elitemobs.config.npcs.NPCsConfig) CustomSpawnConfig(com.magmaguy.elitemobs.config.customspawns.CustomSpawnConfig) File(java.io.File) CustomBossesConfig(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig)

Aggregations

CommandHandler (com.magmaguy.elitemobs.commands.CommandHandler)1 CustomBossesConfig (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig)1 CustomItemsConfig (com.magmaguy.elitemobs.config.customitems.CustomItemsConfig)1 CustomQuestsConfig (com.magmaguy.elitemobs.config.customquests.CustomQuestsConfig)1 CustomSpawnConfig (com.magmaguy.elitemobs.config.customspawns.CustomSpawnConfig)1 CustomTreasureChestsConfig (com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig)1 DungeonPackagerConfig (com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfig)1 NPCsConfig (com.magmaguy.elitemobs.config.npcs.NPCsConfig)1 WormholeConfig (com.magmaguy.elitemobs.config.wormholes.WormholeConfig)1 Minidungeon (com.magmaguy.elitemobs.dungeons.Minidungeon)1 CustomCharts (com.magmaguy.elitemobs.thirdparty.bstats.CustomCharts)1 Placeholders (com.magmaguy.elitemobs.thirdparty.placeholderapi.Placeholders)1 InfoMessage (com.magmaguy.elitemobs.utils.InfoMessage)1 WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)1 File (java.io.File)1 IOException (java.io.IOException)1 Metrics (org.bstats.bukkit.Metrics)1