Search in sources :

Example 6 with Minidungeon

use of com.magmaguy.elitemobs.dungeons.Minidungeon in project EliteMobs by MagmaGuy.

the class TreasureChestCommands method addRelativeTreasureChest.

public static void addRelativeTreasureChest(Player player, String treasureChestFilename, String minidungeonName) {
    Minidungeon minidungeon = Minidungeon.getMinidungeons().get(minidungeonName);
    if (minidungeon == null) {
        player.sendMessage("Invalid minidungeon name!");
        return;
    }
    minidungeon.addRelativeTreasureChest(treasureChestFilename, player.getLocation().getBlock().getLocation(), player);
}
Also used : Minidungeon(com.magmaguy.elitemobs.dungeons.Minidungeon)

Example 7 with Minidungeon

use of com.magmaguy.elitemobs.dungeons.Minidungeon 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)

Example 8 with Minidungeon

use of com.magmaguy.elitemobs.dungeons.Minidungeon in project EliteMobs by MagmaGuy.

the class PlayerTeleportEvent method executeTeleport.

public void executeTeleport() {
    player.teleport(destination);
    for (Minidungeon minidungeon : Minidungeon.getMinidungeons().values()) if (minidungeon.isInstalled() && minidungeon.getDungeonPackagerConfigFields().getDungeonLocationType().equals(DungeonPackagerConfigFields.DungeonLocationType.WORLD) && minidungeon.getWorld().equals(originalLocation.getWorld()))
        return;
    if (AdventurersGuildConfig.getGuildWorldLocation() != null && Objects.equals(AdventurersGuildConfig.getGuildWorldLocation().getWorld(), originalLocation.getWorld()))
        return;
    PlayerData.setBackTeleportLocation(player, originalLocation);
}
Also used : Minidungeon(com.magmaguy.elitemobs.dungeons.Minidungeon)

Example 9 with Minidungeon

use of com.magmaguy.elitemobs.dungeons.Minidungeon in project EliteMobs by MagmaGuy.

the class Wormhole method getDungeonLocation.

private Location getDungeonLocation(String dungeonFilename) {
    Minidungeon minidungeon = Minidungeon.getMinidungeons().get(dungeonFilename);
    if (minidungeon == null) {
        new WarningMessage("Dungeon " + dungeonFilename + " is not a valid dungeon packager name! Wormhole " + getWormholeConfigFields().getFilename() + " will not lead anywhere.");
        setPortalMissingMessage(WormholesConfig.getDefaultPortalMissingMessage());
        return null;
    }
    if (!minidungeon.isDownloaded() || !minidungeon.isInstalled()) {
        new InfoMessage("Wormhole " + getWormholeConfigFields().getFilename() + " will not lead anywhere because the dungeon " + dungeonFilename + " is not installed!");
        setPortalMissingMessage(WormholesConfig.getDungeonNotInstalledMessage().replace("$dungeonID", minidungeon.getDungeonPackagerConfigFields().getName()));
        this.opMessage = ChatColorConverter.convert("&8[EliteMobs - OP-only message] &fDownload links are available on &9https://magmaguy.itch.io/ &f" + "(free and premium) and &9https://www.patreon.com/magmaguy &f(premium). You can check the difference " + "between the two and get support here: " + DiscordLinks.mainLink);
        return null;
    }
    Vector offsetVector = minidungeon.getTeleportLocation().getDirection().clone().setY(0).normalize().multiply(1.5 * getWormholeConfigFields().getSizeMultiplier()).setY(-1 * getWormholeConfigFields().getSizeMultiplier());
    return minidungeon.getTeleportLocation().clone().subtract(offsetVector);
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) Minidungeon(com.magmaguy.elitemobs.dungeons.Minidungeon) InfoMessage(com.magmaguy.elitemobs.utils.InfoMessage) Vector(org.bukkit.util.Vector)

Example 10 with Minidungeon

use of com.magmaguy.elitemobs.dungeons.Minidungeon in project EliteMobs by MagmaGuy.

the class SetupMenu method dungeonStatuses.

private void dungeonStatuses() {
    // continue counting from used inventory slots
    int counter = 1;
    for (Minidungeon minidungeon : Minidungeon.getMinidungeons().values()) {
        if (!Bukkit.getPluginManager().isPluginEnabled("WorldGuard"))
            inventory.setItem(validSlots.get(counter), ItemStackGenerator.generateItemStack(Material.RED_STAINED_GLASS_PANE, ChatColorConverter.convert("&4You need WorldGuard to install Minidungeons correctly!")));
        else
            switch(minidungeon.getDungeonPackagerConfigFields().getDungeonLocationType()) {
                case WORLD:
                    addWorldDungeon(minidungeon, counter);
                    break;
                case SCHEMATIC:
                    addSchematicDungeon(minidungeon, counter);
                    break;
                default:
                    new WarningMessage("Dungeon " + minidungeon.getDungeonPackagerConfigFields().getFilename() + " does not have a valid location type and therefore can't be set up automatically!");
                    break;
            }
        minidungeonHashMap.put(validSlots.get(counter), minidungeon);
        counter++;
    }
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) Minidungeon(com.magmaguy.elitemobs.dungeons.Minidungeon)

Aggregations

Minidungeon (com.magmaguy.elitemobs.dungeons.Minidungeon)13 WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)3 Location (org.bukkit.Location)3 InfoMessage (com.magmaguy.elitemobs.utils.InfoMessage)2 Vector (org.bukkit.util.Vector)2 CommandHandler (com.magmaguy.elitemobs.commands.CommandHandler)1 CustomBossesConfig (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig)1 CustomBossesConfigFields (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields)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 CustomCharts (com.magmaguy.elitemobs.thirdparty.bstats.CustomCharts)1 Placeholders (com.magmaguy.elitemobs.thirdparty.placeholderapi.Placeholders)1 DebugBlockLocation (com.magmaguy.elitemobs.utils.DebugBlockLocation)1 File (java.io.File)1 IOException (java.io.IOException)1