Search in sources :

Example 11 with InfoMessage

use of com.magmaguy.elitemobs.utils.InfoMessage in project EliteMobs by MagmaGuy.

the class CustomWorldLoading method startupWorldInitialization.

public static void startupWorldInitialization() {
    File folder = new File(Bukkit.getWorldContainer().getAbsolutePath());
    File[] listOfFiles = folder.listFiles();
    assert listOfFiles != null;
    for (File listOfFile : listOfFiles) {
        if (listOfFile.isDirectory() && listOfFile.getName().equals(AdventurersGuildConfig.getGuildWorldName())) {
            new InfoMessage("[EliteMobs] World " + AdventurersGuildConfig.getGuildWorldName() + " found! Loading it in...");
            try {
                WorldCreator worldCreator = new WorldCreator(AdventurersGuildConfig.getGuildWorldName());
                Objects.requireNonNull(Bukkit.createWorld(worldCreator)).setKeepSpawnInMemory(false);
                new InfoMessage("[EliteMobs] World " + AdventurersGuildConfig.getGuildWorldName() + " has been successfully loaded! It can be accessed through the '/ag' command, unless you changed that config option!");
            } catch (Exception ex) {
                new WarningMessage("Failed to generate Adventurer's Guild World!");
                ex.printStackTrace();
            }
            break;
        }
    }
}
Also used : WorldCreator(org.bukkit.WorldCreator) WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) InfoMessage(com.magmaguy.elitemobs.utils.InfoMessage) File(java.io.File)

Example 12 with InfoMessage

use of com.magmaguy.elitemobs.utils.InfoMessage 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 13 with InfoMessage

use of com.magmaguy.elitemobs.utils.InfoMessage in project EliteMobs by MagmaGuy.

the class ConfigurationImporter method moveWorlds.

private static void moveWorlds(File worldcontainerFile) {
    for (File file : worldcontainerFile.listFiles()) try {
        File destinationFile = new File(Paths.get(Bukkit.getWorldContainer().getCanonicalPath() + File.separatorChar + file.getName()).normalize().toString());
        if (destinationFile.exists()) {
            new InfoMessage("Overriding existing directory " + destinationFile.getPath());
            if (Bukkit.getWorld(file.getName()) != null) {
                Bukkit.unloadWorld(file.getName(), false);
                new WarningMessage("Unloaded world " + file.getName() + " for safe replacement!");
            }
            deleteDirectory(destinationFile);
        }
        FileUtils.moveDirectory(file, destinationFile);
    } catch (Exception exception) {
        new WarningMessage("Failed to move worlds for " + file.getName() + "! Tell the dev!");
        exception.printStackTrace();
    }
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) InfoMessage(com.magmaguy.elitemobs.utils.InfoMessage) File(java.io.File) ZipFile(com.magmaguy.elitemobs.utils.ZipFile)

Example 14 with InfoMessage

use of com.magmaguy.elitemobs.utils.InfoMessage in project EliteMobs by MagmaGuy.

the class ConfigurationImporter method moveDirectory.

private static void moveDirectory(File unzippedDirectory, Path targetPath) {
    for (File file : unzippedDirectory.listFiles()) try {
        new InfoMessage("Adding " + file.getCanonicalPath());
        moveFile(file, targetPath);
    } catch (Exception exception) {
        new WarningMessage("Failed to move directories for " + file.getName() + "! Tell the dev!");
        exception.printStackTrace();
    }
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) InfoMessage(com.magmaguy.elitemobs.utils.InfoMessage) File(java.io.File) ZipFile(com.magmaguy.elitemobs.utils.ZipFile)

Aggregations

InfoMessage (com.magmaguy.elitemobs.utils.InfoMessage)14 WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)11 File (java.io.File)7 ZipFile (com.magmaguy.elitemobs.utils.ZipFile)3 IOException (java.io.IOException)3 Minidungeon (com.magmaguy.elitemobs.dungeons.Minidungeon)2 WorldCreator (org.bukkit.WorldCreator)2 CustomEventStartEvent (com.magmaguy.elitemobs.api.CustomEventStartEvent)1 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 CustomLootTable (com.magmaguy.elitemobs.items.customloottable.CustomLootTable)1 CustomSpawn (com.magmaguy.elitemobs.mobconstructor.CustomSpawn)1 CustomBossEntity (com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity)1