Search in sources :

Example 36 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, Minidungeon minidungeon) {
    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, minidungeon);
        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 37 with WarningMessage

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

the class DisguiseEntity method customDisguise.

private static void customDisguise(String customDisguise, Entity entity, String customDisguiseData, String filename) {
    Disguise disguise = DisguiseAPI.getCustomDisguise(customDisguise);
    try {
        if (disguise == null)
            if (customDisguiseData != null) {
                DisguiseAPI.addCustomDisguise(customDisguise, customDisguiseData);
                disguise = DisguiseAPI.getCustomDisguise(customDisguise);
            }
        if (disguise == null)
            throw new NullPointerException();
        disguise.setEntity(entity);
        disguise.setDisguiseName(entity.getCustomName());
        disguise.setDynamicName(true);
        disguise.startDisguise();
    } catch (Exception ex) {
        new WarningMessage("Failed to set custom disguise for " + filename + " !");
        new WarningMessage("Does the disguise exist? Is LibsDisguises up-to-date?");
    }
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage)

Example 38 with WarningMessage

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

the class DisguiseEntity method disguise.

/**
 * This method disguises the entity based on a config entry. It should be invoked after checking if libsdisguises
 * is in the server.
 *
 * @param disguiseName Raw name following config format
 */
public static void disguise(String disguiseName, Entity entity, String customDisguiseData, String filename) {
    if (disguiseName.contains("player:")) {
        playerDisguise(disguiseName.replace("player:", ""), entity);
        return;
    }
    if (disguiseName.contains("custom")) {
        try {
            customDisguise(disguiseName.replace("custom:", ""), entity, customDisguiseData, filename);
        } catch (Exception ex) {
            new WarningMessage("Failed to assign custom disguise " + disguiseName + "! Did you configure the disguise correctly?");
        }
        return;
    }
    DisguiseType disguiseType;
    try {
        disguiseType = DisguiseType.valueOf(disguiseName);
    } catch (Exception ex) {
        new WarningMessage("Disguise " + disguiseName + " is not a valid disguise name! Entity " + entity.getCustomName() + " will not have a disguise.");
        return;
    }
    if (disguiseType.isMob())
        livingEntityDisguise(disguiseType, entity);
    else if (disguiseType.isMisc())
        miscEntityDisguise(disguiseType, entity);
    else
        new WarningMessage("Disguise " + disguiseName + " is not a valid disguise name! Entity " + entity.getCustomName() + " will not have a disguise.");
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage)

Example 39 with WarningMessage

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

the class ItemLootShower method dropFifty.

private void dropFifty(Location location) {
    Item currencyItem;
    try {
        currencyItem = generateCurrencyItem(Material.getMaterial(EconomySettingsConfig.getLootShowerMaterial50()), location, 50);
    } catch (Exception ex) {
        new WarningMessage("Material for EliteMob shower 50 is invalid. Defaulting to emerald block.");
        currencyItem = generateCurrencyItem(Material.EMERALD_BLOCK, location, 50);
    }
    currencyItem.setCustomName(ChatColorConverter.convert("&2" + 50 + " " + EconomySettingsConfig.getCurrencyName()));
    currencyItem.setCustomNameVisible(true);
}
Also used : Item(org.bukkit.entity.Item) WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage)

Example 40 with WarningMessage

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

the class ItemLootShower method dropOne.

private void dropOne(Location location) {
    Item currencyItem;
    try {
        currencyItem = generateCurrencyItem(Material.getMaterial(EconomySettingsConfig.getLootShowerMaterial1()), location, 1);
    } catch (Exception ex) {
        new WarningMessage("Material for EliteMob shower 1 is invalid. Defaulting to gold nugget.");
        currencyItem = generateCurrencyItem(Material.GOLD_NUGGET, location, 1);
    }
    currencyItem.setCustomName(ChatColorConverter.convert("&7" + 1 + " " + EconomySettingsConfig.getCurrencyName()));
    currencyItem.setCustomNameVisible(true);
}
Also used : Item(org.bukkit.entity.Item) WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage)

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