Search in sources :

Example 56 with WarningMessage

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

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

the class TreasureChest method generateChest.

private void generateChest() {
    try {
        if (!location.getWorld().getBlockAt(location).getType().equals(customTreasureChestConfigFields.getChestMaterial()))
            location.getWorld().getBlockAt(location).setType(customTreasureChestConfigFields.getChestMaterial());
    } catch (Exception ex) {
        new WarningMessage("Custom Treasure Chest " + customTreasureChestConfigFields.getFilename() + " has an invalid location and can not be placed.");
        return;
    }
    if (location.getBlock().getBlockData() instanceof Directional) {
        Directional chest = (Directional) location.getBlock().getBlockData();
        chest.setFacing(customTreasureChestConfigFields.getFacing());
        location.getBlock().setBlockData(chest);
    } else {
        new WarningMessage("Treasure chest " + customTreasureChestConfigFields.getFilename() + " does not have a directional block for the Treasure Chest material " + customTreasureChestConfigFields.getChestMaterial() + " ! Chest materials are directional, is your chest a chest?");
    }
    location.getBlock().getState().update();
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) Directional(org.bukkit.block.data.Directional)

Example 58 with WarningMessage

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

the class WorldGuardCompatibility method protectMinidungeonArea.

public static boolean protectMinidungeonArea(String regionName, Location location) {
    try {
        RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
        RegionManager regions = container.get(BukkitAdapter.adapt(location.getWorld()));
        ProtectedRegion protectedRegion = regions.getRegion(regionName);
        if (protectedRegion == null) {
            new WarningMessage("The region name picked did not exist!");
            return false;
        }
        protectMinidungeonArea(protectedRegion);
        return true;
    } catch (Exception ex) {
        new WarningMessage("Failed to protect region " + regionName + " !");
        return false;
    }
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) RegionContainer(com.sk89q.worldguard.protection.regions.RegionContainer) ProtectedRegion(com.sk89q.worldguard.protection.regions.ProtectedRegion) GlobalProtectedRegion(com.sk89q.worldguard.protection.regions.GlobalProtectedRegion) RegionManager(com.sk89q.worldguard.protection.managers.RegionManager) FlagConflictException(com.sk89q.worldguard.protection.flags.registry.FlagConflictException)

Example 59 with WarningMessage

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

the class CustomConfigFields method processEnum.

public <T extends Enum<T>> T processEnum(String path, T value, T pluginDefault, Class<T> enumClass, boolean forceWriteDefault) {
    if (!configHas(path)) {
        if (forceWriteDefault || value != pluginDefault) {
            String valueString = null;
            if (value != null)
                valueString = value.toString().toUpperCase();
            String pluginDefaultString = null;
            if (pluginDefault != null)
                pluginDefaultString = pluginDefault.toString().toUpperCase();
            processString(path, valueString, pluginDefaultString, forceWriteDefault);
        }
        return value;
    }
    try {
        return (T) Enum.valueOf(enumClass, fileConfiguration.getString(path).toUpperCase());
    } catch (Exception ex) {
        new WarningMessage("File " + filename + " has an incorrect entry for " + path);
        new WarningMessage("Entry: " + value);
    }
    return value;
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage)

Example 60 with WarningMessage

use of com.magmaguy.elitemobs.utils.WarningMessage 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

WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)76 InfoMessage (com.magmaguy.elitemobs.utils.InfoMessage)11 Vector (org.bukkit.util.Vector)11 Item (org.bukkit.entity.Item)10 File (java.io.File)9 CustomBossEntity (com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity)8 FlagConflictException (com.sk89q.worldguard.protection.flags.registry.FlagConflictException)7 RegionManager (com.sk89q.worldguard.protection.managers.RegionManager)6 RegionContainer (com.sk89q.worldguard.protection.regions.RegionContainer)6 ArrayList (java.util.ArrayList)6 ZipFile (com.magmaguy.elitemobs.utils.ZipFile)5 GlobalProtectedRegion (com.sk89q.worldguard.protection.regions.GlobalProtectedRegion)5 ProtectedRegion (com.sk89q.worldguard.protection.regions.ProtectedRegion)5 Location (org.bukkit.Location)5 ItemStack (org.bukkit.inventory.ItemStack)5 CustomBossesConfigFields (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields)3 Minidungeon (com.magmaguy.elitemobs.dungeons.Minidungeon)3 IOException (java.io.IOException)3 Material (org.bukkit.Material)3 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)3