Search in sources :

Example 41 with WarningMessage

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

the class ItemLootShower method dropOneThousand.

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

Example 42 with WarningMessage

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

the class Minidungeon method loadWorld.

private void loadWorld(Player player) {
    try {
        world = MinidungeonWorldLoader.loadWorld(this);
        if (world == null) {
            player.sendMessage("Failed to get world " + this.dungeonPackagerConfigFields.getWorldName() + " . Can not complete installation correctly.");
            return;
        }
        WorldGuardCompatibility.protectWorldMinidugeonArea(world.getSpawnLocation(), this);
        player.teleport(world.getSpawnLocation());
        player.sendMessage("Minidungeon " + dungeonPackagerConfigFields.getWorldName() + " has been loaded! The world is now loaded and the regional bosses are up.");
        player.sendMessage(ChatColorConverter.convert("&cYou might want to do &a/em reload &cto fix the initial spawns, skins and wormholes!"));
        if (dungeonPackagerConfigFields.isHasCustomModels())
            if (!Bukkit.getPluginManager().isPluginEnabled("ModelEngine")) {
                player.sendMessage(ChatColorConverter.convert("&c[EliteMobs] The dungeon you just installed has custom models, but you do not have Model Engine! Download it here if you want to use Custom Models: https://www.spigotmc.org/resources/conxeptworks-model-engine%E2%80%94ultimate-custom-entity-model-manager-1-14-1-18-1.79477/"));
                player.sendMessage(ChatColorConverter.convert("&c[EliteMobs] Please note that currently only version 2.4.0 is supported!"));
            } else
                player.spigot().sendMessage(SpigotMessage.commandHoverMessage(ChatColorConverter.convert("&8[EliteMobs] &2The dungeon you just installed has Custom Models! " + "&2Click here to generate the EliteMobs resource pack for those models!"), "Clicking will run the command /em generateresourcepack", "/em generateresourcepack"));
        isInstalled = true;
        setWorldSpawn();
    } catch (Exception exception) {
        new WarningMessage("Warning: Failed to load the " + dungeonPackagerConfigFields.getWorldName() + " world!");
        player.sendMessage("Warning: Failed to load the " + dungeonPackagerConfigFields.getWorldName() + " world!");
        exception.printStackTrace();
    }
    if (isInstalled)
        quantifyWorldBosses();
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage)

Example 43 with WarningMessage

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

the class ItemLootShower method generateCurrencyItem.

private Item generateCurrencyItem(Material material, Location location, double value) {
    ItemStack currencyItemStack = SoulbindEnchantment.addEnchantment(ItemStackGenerator.generateItemStack(material, "", Arrays.asList("EliteMobsCurrencyItem", value + "", ThreadLocalRandom.current().nextDouble() + "")), player);
    int model = 1;
    try {
        model = EconomySettingsConfig.getThisConfiguration().getInt("lootShowerMaterial." + (int) value);
    } catch (Exception ex) {
        new WarningMessage("Failed to get coin model for value " + value + " !");
    }
    setCoinModel(currencyItemStack, model);
    Item currencyItem = location.getWorld().dropItem(location.clone().add(new Vector(0, 1, 0)), currencyItemStack);
    EntityTracker.registerVisualEffects(currencyItem);
    currencyItem.setVelocity(new Vector((ThreadLocalRandom.current().nextDouble() - 0.5) / 2, 0.5, (ThreadLocalRandom.current().nextDouble() - 0.5) / 2));
    SoulbindEnchantment.addPhysicalDisplay(currencyItem, this.player);
    new Coin(value, player, currencyItem);
    return currencyItem;
}
Also used : Item(org.bukkit.entity.Item) WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) ItemStack(org.bukkit.inventory.ItemStack) Vector(org.bukkit.util.Vector)

Example 44 with WarningMessage

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

the class ItemLootShower method dropOneHundred.

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

Example 45 with WarningMessage

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

the class ItemLootShower method dropFive.

private void dropFive(Location location) {
    Item currencyItem;
    try {
        currencyItem = generateCurrencyItem(Material.getMaterial(EconomySettingsConfig.getLootShowerMaterial5()), location, 5);
    } catch (Exception ex) {
        new WarningMessage("Material for EliteMob shower 5 is invalid. Defaulting to gold ingot.");
        currencyItem = generateCurrencyItem(Material.GOLD_INGOT, location, 5);
    }
    currencyItem.setCustomName(ChatColorConverter.convert("&f" + 5 + " " + 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