Search in sources :

Example 31 with FixedMetadataValue

use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.

the class SpawnMobCommandHandler method spawnMob.

public void spawnMob(CommandSender commandSender, String[] args) {
    World world = null;
    Location location = null;
    String entityInput = null;
    int mobLevel = 0;
    List<String> mobPower = new ArrayList<>();
    if (commandSender instanceof Player) {
        Player player = (Player) commandSender;
        if (args.length == 1) {
            player.sendMessage("Valid command syntax:");
            player.sendMessage("/elitemobs SpawnMob [mobType] [mobLevel] [mobPower] [mobPower(you can keep adding these mobPowers as many as you'd like)]");
        }
        world = player.getWorld();
        location = player.getTargetBlock((HashSet<Byte>) null, 30).getLocation().add(0, 1, 0);
        entityInput = args[1].toLowerCase();
        if (args.length > 2) {
            try {
                mobLevel = Integer.valueOf(args[2]);
            } catch (NumberFormatException ex) {
                player.sendMessage("Not a valid level.");
                player.sendMessage("Valid command syntax:");
                player.sendMessage("/elitemobs SpawnMob [mobType] [mobLevel] [mobPower] [mobPower(you can keep adding these mobPowers as many as you'd like)]");
            }
        }
        if (args.length > 3) {
            int index = 0;
            for (String arg : args) {
                //mob powers start after arg 2
                if (index > 2) {
                    mobPower.add(arg);
                }
                index++;
            }
        }
    } else if (commandSender instanceof ConsoleCommandSender || commandSender instanceof BlockCommandSender) {
        for (World worldIterator : worldList) {
            //find world
            if (worldIterator.getName().equals(args[1])) {
                world = worldIterator;
                //find x coord
                try {
                    double xCoord = Double.parseDouble(args[2]);
                    double yCoord = Double.parseDouble(args[3]);
                    double zCoord = Double.parseDouble(args[4]);
                    location = new Location(worldIterator, xCoord, yCoord, zCoord);
                    entityInput = args[5].toLowerCase();
                    break;
                } catch (NumberFormatException ex) {
                    getConsoleSender().sendMessage("At least one of the coordinates (x:" + args[2] + ", y:" + args[3] + ", z:" + args[4] + ") is not valid");
                    getConsoleSender().sendMessage("Valid command syntax: /elitemobs SpawnMob worldName xCoord yCoord " + "zCoord mobType mobLevel mobPower mobPower(you can keep adding these mobPowers as many as you'd like)");
                }
                if (args.length > 6) {
                    int index = 0;
                    for (String arg : args) {
                        //mob powers start after arg 2
                        if (index > 2) {
                            mobPower.add(arg);
                        }
                        index++;
                    }
                }
            }
        }
        if (world == null) {
            getConsoleSender().sendMessage("World " + args[1] + "not found. Valid command syntax: /elitemobs SpawnMob" + " [worldName] [xCoord] [yCoord] [zCoord] [mobType] [mobLevel] [mobPower] [mobPower(you can keep adding these " + "mobPowers as many as you'd like)]");
        }
    }
    EntityType entityType = null;
    switch(entityInput) {
        case "blaze":
            entityType = EntityType.BLAZE;
            break;
        case "cavespider":
            entityType = EntityType.CAVE_SPIDER;
            break;
        case "creeper":
            entityType = EntityType.CREEPER;
            break;
        case "enderman":
            entityType = EntityType.ENDERMAN;
            break;
        case "endermite":
            entityType = EntityType.ENDERMITE;
            break;
        case "husk":
            entityType = EntityType.HUSK;
            break;
        case "irongolem":
            entityType = EntityType.IRON_GOLEM;
            break;
        case "pigzombie":
            entityType = EntityType.PIG_ZOMBIE;
            break;
        case "polarbear":
            entityType = EntityType.POLAR_BEAR;
            break;
        case "silverfish":
            entityType = EntityType.SILVERFISH;
            break;
        case "skeleton":
            entityType = EntityType.SKELETON;
            break;
        case "spider":
            entityType = EntityType.SPIDER;
            break;
        case "stray":
            entityType = EntityType.STRAY;
            break;
        case "witch":
            entityType = EntityType.WITCH;
            break;
        case "witherskeleton":
            entityType = EntityType.WITHER_SKELETON;
            break;
        case "zombie":
            entityType = EntityType.ZOMBIE;
            break;
        case "chicken":
            entityType = EntityType.CHICKEN;
            break;
        case "cow":
            entityType = EntityType.COW;
            break;
        case "mushroomcow":
            entityType = EntityType.MUSHROOM_COW;
            break;
        case "pig":
            entityType = EntityType.PIG;
            break;
        case "sheep":
            entityType = EntityType.SHEEP;
            break;
        default:
            if (commandSender instanceof Player) {
                ((Player) commandSender).getPlayer().sendTitle("Could not spawn mob type " + entityInput, "If this is incorrect, please contact the dev.");
            } else if (commandSender instanceof ConsoleCommandSender) {
                getConsoleSender().sendMessage("Could not spawn mob type " + entityInput + ". If this is incorrect, " + "please contact the dev.");
            }
            break;
    }
    Entity entity = null;
    if (entityType != null) {
        entity = world.spawnEntity(location, entityType);
    }
    if (entityType == EntityType.CHICKEN || entityType == EntityType.COW || entityType == EntityType.MUSHROOM_COW || entityType == EntityType.PIG || entityType == EntityType.SHEEP) {
        HealthHandler.passiveHealthHandler(entity, ConfigValues.defaultConfig.getInt("Passive EliteMob stack amount"));
        NameHandler.customPassiveName(entity, plugin);
        return;
    }
    if (mobLevel > 0) {
        entity.setMetadata(MetadataHandler.ELITE_MOB_MD, new FixedMetadataValue(plugin, mobLevel));
    }
    if (mobPower.size() > 0) {
        boolean inputError = false;
        int powerCount = 0;
        MetadataHandler metadataHandler = new MetadataHandler();
        for (String string : mobPower) {
            switch(string) {
                //major powers
                case MetadataHandler.ZOMBIE_FRIENDS_H:
                    if (entity instanceof Zombie) {
                        entity.setMetadata(MetadataHandler.ZOMBIE_FRIENDS_MD, new FixedMetadataValue(plugin, true));
                        powerCount++;
                    }
                    break;
                case MetadataHandler.ZOMBIE_NECRONOMICON_H:
                    if (entity instanceof Zombie) {
                        entity.setMetadata(MetadataHandler.ZOMBIE_NECRONOMICON_MD, new FixedMetadataValue(plugin, true));
                        powerCount++;
                    }
                    break;
                case MetadataHandler.ZOMBIE_TEAM_ROCKET_H:
                    if (entity instanceof Zombie) {
                        entity.setMetadata(MetadataHandler.ZOMBIE_TEAM_ROCKET_MD, new FixedMetadataValue(plugin, true));
                        powerCount++;
                    }
                    break;
                case MetadataHandler.ZOMBIE_PARENTS_H:
                    if (entity instanceof Zombie) {
                        entity.setMetadata(MetadataHandler.ZOMBIE_PARENTS_MD, new FixedMetadataValue(plugin, true));
                        powerCount++;
                    }
                    break;
                //minor powers
                case MetadataHandler.ATTACK_ARROW_H:
                    entity.setMetadata(MetadataHandler.ATTACK_ARROW_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.ATTACK_BLINDING_H:
                    entity.setMetadata(MetadataHandler.ATTACK_BLINDING_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.ATTACK_CONFUSING_H:
                    entity.setMetadata(MetadataHandler.ATTACK_CONFUSING_MD, new FixedMetadataValue(plugin, true));
                    //                        minorPowerPowerStance.attackConfusing(entity);
                    powerCount++;
                    break;
                case MetadataHandler.ATTACK_FIRE_H:
                    entity.setMetadata(MetadataHandler.ATTACK_FIRE_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.ATTACK_FIREBALL_H:
                    entity.setMetadata(MetadataHandler.ATTACK_FIREBALL_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.ATTACK_FREEZE_H:
                    entity.setMetadata(MetadataHandler.ATTACK_FREEZE_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.ATTACK_GRAVITY_H:
                    entity.setMetadata(MetadataHandler.ATTACK_GRAVITY_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.ATTACK_POISON_H:
                    entity.setMetadata(MetadataHandler.ATTACK_POISON_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.ATTACK_PUSH_H:
                    entity.setMetadata(MetadataHandler.ATTACK_PUSH_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.ATTACK_WEAKNESS_H:
                    entity.setMetadata(MetadataHandler.ATTACK_WEAKNESS_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.ATTACK_WEB_H:
                    entity.setMetadata(MetadataHandler.ATTACK_WEB_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.ATTACK_WITHER_H:
                    entity.setMetadata(MetadataHandler.ATTACK_WITHER_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.BONUS_LOOT_H:
                    entity.setMetadata(MetadataHandler.BONUS_LOOT_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.DOUBLE_DAMAGE_H:
                    if (!(entity instanceof IronGolem)) {
                        entity.setMetadata(MetadataHandler.DOUBLE_DAMAGE_MD, new FixedMetadataValue(plugin, true));
                    }
                    powerCount++;
                    break;
                case MetadataHandler.DOUBLE_HEALTH_H:
                    if (!(entity instanceof IronGolem)) {
                        entity.setMetadata(MetadataHandler.DOUBLE_HEALTH_MD, new FixedMetadataValue(plugin, true));
                    }
                    powerCount++;
                    break;
                case MetadataHandler.INVISIBILITY_H:
                    entity.setMetadata(MetadataHandler.INVISIBILITY_MD, new FixedMetadataValue(plugin, true));
                    ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1));
                    powerCount++;
                    break;
                case MetadataHandler.INVULNERABILITY_ARROW_H:
                    entity.setMetadata(MetadataHandler.INVULNERABILITY_ARROW_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.INVULNERABILITY_FALL_DAMAGE_H:
                    entity.setMetadata(MetadataHandler.INVULNERABILITY_FALL_DAMAGE_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.INVULNERABILITY_FIRE_H:
                    entity.setMetadata(MetadataHandler.INVULNERABILITY_FIRE_MD, new FixedMetadataValue(plugin, true));
                    //                        minorPowerPowerStance.invulnerabilityFireEffect(entity);
                    powerCount++;
                    break;
                case MetadataHandler.INVULNERABILITY_KNOCKBACK_H:
                    entity.setMetadata(MetadataHandler.INVULNERABILITY_KNOCKBACK_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case MetadataHandler.MOVEMENT_SPEED_H:
                    entity.setMetadata(MetadataHandler.MOVEMENT_SPEED_MD, new FixedMetadataValue(plugin, true));
                    ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 2));
                    powerCount++;
                    break;
                case MetadataHandler.TAUNT_H:
                    entity.setMetadata(MetadataHandler.TAUNT_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                case "custom":
                    entity.setMetadata(MetadataHandler.CUSTOM_POWERS_MD, new FixedMetadataValue(plugin, true));
                    powerCount++;
                    break;
                default:
                    if (commandSender instanceof Player) {
                        Player player = (Player) commandSender;
                        player.sendMessage(string + " is not a valid power.");
                    } else if (commandSender instanceof ConsoleCommandSender) {
                        getConsoleSender().sendMessage(string + " is not a valid power.");
                    }
                    inputError = true;
            }
        }
        entity.setMetadata(MetadataHandler.MINOR_POWER_AMOUNT_MD, new FixedMetadataValue(plugin, powerCount));
        minorPowerPowerStance.itemEffect(entity);
        majorPowerPowerStance.itemEffect(entity);
        if (inputError) {
            if (commandSender instanceof Player) {
                Player player = (Player) commandSender;
                player.sendMessage("Valid powers: " + MetadataHandler.powerListHumanFormat() + " custom");
            } else if (commandSender instanceof ConsoleCommandSender) {
                getConsoleSender().sendMessage("Valid powers: " + MetadataHandler.powerListHumanFormat() + MetadataHandler.majorPowerList() + " custom");
            }
        }
    }
}
Also used : PotionEffect(org.bukkit.potion.PotionEffect) ArrayList(java.util.ArrayList) FixedMetadataValue(org.bukkit.metadata.FixedMetadataValue) MetadataHandler(com.magmaguy.elitemobs.MetadataHandler) World(org.bukkit.World) ConsoleCommandSender(org.bukkit.command.ConsoleCommandSender) Location(org.bukkit.Location) HashSet(java.util.HashSet) BlockCommandSender(org.bukkit.command.BlockCommandSender)

Example 32 with FixedMetadataValue

use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.

the class ZombieFriends method applyPowers.

@Override
public void applyPowers(Entity entity) {
    entity.setMetadata(powerMetadata, new FixedMetadataValue(plugin, true));
    MajorPowerPowerStance majorPowerStanceMath = new MajorPowerPowerStance();
    majorPowerStanceMath.itemEffect(entity);
}
Also used : FixedMetadataValue(org.bukkit.metadata.FixedMetadataValue) MajorPowerPowerStance(com.magmaguy.elitemobs.powerstances.MajorPowerPowerStance)

Example 33 with FixedMetadataValue

use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.

the class ZombieNecronomicon method onPlayerDetect.

@EventHandler
public void onPlayerDetect(EntityTargetEvent event) {
    Entity targetter = event.getEntity();
    Entity targetted = event.getTarget();
    if (targetter.hasMetadata(MetadataHandler.ZOMBIE_CHANTING)) {
        return;
    }
    targetter.setMetadata(MetadataHandler.ZOMBIE_CHANTING, new FixedMetadataValue(plugin, true));
    if (targetted instanceof Player && targetter.hasMetadata(powerMetadata)) {
        ((LivingEntity) targetter).setAI(false);
        necronomiconVisualEffect((Zombie) targetter);
        new BukkitRunnable() {

            ArrayList<Entity> entityList = new ArrayList<>();

            @Override
            public void run() {
                if (!targetted.isValid() || !targetter.isValid() || targetted.getWorld() != targetter.getWorld() || targetted.getLocation().distance(targetter.getLocation()) > 30) {
                    for (Entity entity : entityList) {
                        if (entity.isValid()) {
                            entity.remove();
                        }
                    }
                    ((LivingEntity) targetter).setAI(true);
                    targetter.removeMetadata(MetadataHandler.ZOMBIE_CHANTING, plugin);
                    cancel();
                    return;
                }
                int randomizedNumber = random.nextInt(5) + 1;
                for (Iterator<Entity> iterator = entityList.iterator(); iterator.hasNext(); ) {
                    Entity currentEntity = iterator.next();
                    if (!currentEntity.isValid()) {
                        iterator.remove();
                    }
                }
                if (entityList.size() < 11) {
                    ((Zombie) targetter).setAI(false);
                    if (!summoningEffectOn) {
                        necronomiconVisualEffect((Zombie) targetter);
                    }
                    if (randomizedNumber < 5) {
                        Zombie zombie = (Zombie) targetter.getWorld().spawnEntity(targetter.getLocation(), EntityType.ZOMBIE);
                        zombie.setMetadata(MetadataHandler.ELITE_MOB_MD, new FixedMetadataValue(plugin, 1));
                        zombie.setMetadata(MetadataHandler.FORBIDDEN_MD, new FixedMetadataValue(plugin, true));
                        zombie.setMetadata(MetadataHandler.CUSTOM_POWERS_MD, new FixedMetadataValue(plugin, true));
                        zombie.setMetadata(MetadataHandler.CUSTOM_NAME, new FixedMetadataValue(plugin, true));
                        zombie.setMetadata(MetadataHandler.CUSTOM_HEALTH, new FixedMetadataValue(plugin, true));
                        zombie.setMaxHealth(zombie.getMaxHealth() / 2);
                        zombie.setCustomName(chatColorConverter(configuration.getString("ZombieNecronomicon.Summoned zombie")));
                        zombie.setCustomNameVisible(true);
                        zombie.setVelocity(new Vector((random.nextDouble() - 0.5) / 30, 0.5, (random.nextDouble() - 0.5) / 30));
                        entityList.add(zombie);
                    } else {
                        Skeleton skeleton = (Skeleton) targetter.getWorld().spawnEntity(targetter.getLocation(), EntityType.SKELETON);
                        skeleton.setMetadata(MetadataHandler.ELITE_MOB_MD, new FixedMetadataValue(plugin, 1));
                        skeleton.setMetadata(MetadataHandler.FORBIDDEN_MD, new FixedMetadataValue(plugin, true));
                        skeleton.setMetadata(MetadataHandler.CUSTOM_POWERS_MD, new FixedMetadataValue(plugin, true));
                        skeleton.setMetadata(MetadataHandler.CUSTOM_NAME, new FixedMetadataValue(plugin, true));
                        skeleton.setMetadata(MetadataHandler.CUSTOM_HEALTH, new FixedMetadataValue(plugin, true));
                        skeleton.setMaxHealth(skeleton.getMaxHealth() / 2);
                        skeleton.setCustomName(chatColorConverter(configuration.getString("ZombieNecronomicon.Summoned skeleton")));
                        skeleton.setCustomNameVisible(true);
                        skeleton.setVelocity(new Vector((random.nextDouble() - 0.5) / 30, 0.5, (random.nextDouble() - 0.5) / 30));
                        entityList.add(skeleton);
                    }
                } else {
                    ((Zombie) targetter).setAI(true);
                }
            }
        }.runTaskTimer(plugin, 20 * 3, 20 * 5);
    }
}
Also used : FixedMetadataValue(org.bukkit.metadata.FixedMetadataValue) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) Vector(org.bukkit.util.Vector) EventHandler(org.bukkit.event.EventHandler)

Example 34 with FixedMetadataValue

use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.

the class ZombieTeamRocket method onHit.

@EventHandler
public void onHit(EntityDamageEvent event) {
    if (event.getEntity().hasMetadata(powerMetadata) && event.getEntity() instanceof Zombie && !event.getEntity().hasMetadata(MetadataHandler.TEAM_ROCKET_ACTIVATED) && random.nextDouble() < 0.5) {
        Entity entity = event.getEntity();
        entity.setMetadata(MetadataHandler.TEAM_ROCKET_ACTIVATED, new FixedMetadataValue(plugin, true));
        int assistMobLevel = (int) Math.floor(entity.getMetadata(MetadataHandler.ELITE_MOB_MD).get(0).asInt() / 4);
        if (assistMobLevel < 1) {
            assistMobLevel = 1;
        }
        LeatherArmorMeta teamRocketChestpieceMeta = (LeatherArmorMeta) TEAM_ROCKET_CHESTPIECE.getItemMeta();
        teamRocketChestpieceMeta.setColor(Color.WHITE);
        TEAM_ROCKET_CHESTPIECE.setItemMeta(teamRocketChestpieceMeta);
        LeatherArmorMeta teamRocketLeggingsMeta = (LeatherArmorMeta) TEAM_ROCKET_CHESTPIECE.getItemMeta();
        teamRocketLeggingsMeta.setColor(Color.WHITE);
        TEAM_ROCKET_LEGGINGS.setItemMeta(teamRocketLeggingsMeta);
        LeatherArmorMeta teamRocketBootsMeta = (LeatherArmorMeta) TEAM_ROCKET_BOOTS.getItemMeta();
        teamRocketBootsMeta.setColor(Color.BLACK);
        TEAM_ROCKET_BOOTS.setItemMeta(teamRocketBootsMeta);
        ItemStack jesseHelmet = TEAM_ROCKET_HELMET.clone();
        LeatherArmorMeta jesseHelmetMeta = (LeatherArmorMeta) jesseHelmet.getItemMeta();
        jesseHelmetMeta.setColor(Color.PURPLE);
        jesseHelmet.setItemMeta(jesseHelmetMeta);
        ItemStack jamesHelmet = TEAM_ROCKET_HELMET.clone();
        LeatherArmorMeta jamesHelmetMeta = (LeatherArmorMeta) jamesHelmet.getItemMeta();
        jamesHelmetMeta.setColor(Color.BLUE);
        jamesHelmet.setItemMeta(jamesHelmetMeta);
        Zombie jesse = (Zombie) entity.getWorld().spawnEntity(entity.getLocation(), EntityType.ZOMBIE);
        jesse.setMetadata(MetadataHandler.ELITE_MOB_MD, new FixedMetadataValue(plugin, assistMobLevel));
        jesse.setMetadata(MetadataHandler.CUSTOM_NAME, new FixedMetadataValue(plugin, true));
        jesse.setMetadata(MetadataHandler.CUSTOM_ARMOR, new FixedMetadataValue(plugin, true));
        jesse.setMetadata(MetadataHandler.FORBIDDEN_MD, new FixedMetadataValue(plugin, true));
        jesse.setMetadata(MetadataHandler.CUSTOM_POWERS_MD, new FixedMetadataValue(plugin, true));
        jesse.setMetadata(MetadataHandler.TEAM_ROCKET_MEMBER, new FixedMetadataValue(plugin, true));
        jesse.setCustomName("Jesse");
        jesse.getEquipment().setHelmet(jesseHelmet);
        jesse.getEquipment().setChestplate(TEAM_ROCKET_CHESTPIECE);
        jesse.getEquipment().setLeggings(TEAM_ROCKET_LEGGINGS);
        jesse.getEquipment().setBoots(TEAM_ROCKET_BOOTS);
        Zombie james = (Zombie) entity.getWorld().spawnEntity(entity.getLocation(), EntityType.ZOMBIE);
        james.setMetadata(MetadataHandler.ELITE_MOB_MD, new FixedMetadataValue(plugin, assistMobLevel));
        james.setMetadata(MetadataHandler.CUSTOM_NAME, new FixedMetadataValue(plugin, true));
        james.setMetadata(MetadataHandler.CUSTOM_ARMOR, new FixedMetadataValue(plugin, true));
        james.setMetadata(MetadataHandler.FORBIDDEN_MD, new FixedMetadataValue(plugin, true));
        james.setMetadata(MetadataHandler.CUSTOM_POWERS_MD, new FixedMetadataValue(plugin, true));
        james.setMetadata(MetadataHandler.TEAM_ROCKET_MEMBER, new FixedMetadataValue(plugin, true));
        james.setCustomName("James");
        james.getEquipment().setHelmet(jamesHelmet);
        james.getEquipment().setChestplate(TEAM_ROCKET_CHESTPIECE);
        james.getEquipment().setLeggings(TEAM_ROCKET_LEGGINGS);
        james.getEquipment().setBoots(TEAM_ROCKET_BOOTS);
        Ocelot meowth = (Ocelot) entity.getWorld().spawnEntity(entity.getLocation(), EntityType.OCELOT);
        meowth.setMetadata(MetadataHandler.TEAM_ROCKET_MEMBER, new FixedMetadataValue(plugin, true));
        meowth.setCustomName("Meowth");
        ((Zombie) entity).getEquipment().setChestplate(TEAM_ROCKET_CHESTPIECE);
        ((Zombie) entity).getEquipment().setLeggings(TEAM_ROCKET_LEGGINGS);
        ((Zombie) entity).getEquipment().setBoots(TEAM_ROCKET_BOOTS);
        entity.setMetadata(MetadataHandler.CUSTOM_ARMOR, new FixedMetadataValue(plugin, true));
        Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {

            int counter = 1;

            @Override
            public void run() {
                switch(counter) {
                    case 1:
                        jesse.setCustomNameVisible(true);
                        jesse.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(0)));
                        break;
                    case 2:
                        jesse.setCustomNameVisible(false);
                        james.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(1)));
                        james.setCustomNameVisible(true);
                        break;
                    case 3:
                        james.setCustomNameVisible(false);
                        jesse.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(2)));
                        jesse.setCustomNameVisible(true);
                        break;
                    case 4:
                        jesse.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(3)));
                        break;
                    case 5:
                        jesse.setCustomNameVisible(false);
                        james.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(4)));
                        james.setCustomNameVisible(true);
                        break;
                    case 6:
                        james.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(5)));
                        break;
                    case 7:
                        james.setCustomNameVisible(false);
                        jesse.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(6)));
                        jesse.setCustomNameVisible(true);
                        break;
                    case 8:
                        jesse.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(7)));
                        break;
                    case 9:
                        jesse.setCustomNameVisible(false);
                        james.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(8)));
                        james.setCustomNameVisible(true);
                        break;
                    case 10:
                        james.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(9)));
                        break;
                    case 11:
                        james.setCustomNameVisible(false);
                        jesse.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(10)));
                        jesse.setCustomNameVisible(true);
                        break;
                    case 12:
                        jesse.setCustomNameVisible(false);
                        james.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(11)));
                        james.setCustomNameVisible(true);
                        break;
                    case 13:
                        james.setCustomNameVisible(false);
                        jesse.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(12)));
                        jesse.setCustomNameVisible(true);
                        break;
                    case 14:
                        jesse.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(13)));
                        break;
                    case 15:
                        jesse.setCustomNameVisible(false);
                        james.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(14)));
                        james.setCustomNameVisible(true);
                        break;
                    case 16:
                        james.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(15)));
                        break;
                    case 17:
                        james.setCustomNameVisible(false);
                        meowth.setCustomName(chatColorConverter(configuration.getStringList("ZombieTeamRocket.Intro").get(16)));
                        meowth.setCustomNameVisible(true);
                        break;
                    default:
                        jesse.setCustomName(chatColorConverter(configuration.getString("ZombieTeamRocket.Jesse name")));
                        jesse.setCustomNameVisible(true);
                        james.setCustomName(chatColorConverter(configuration.getString("ZombieTeamRocket.James name")));
                        james.setCustomNameVisible(true);
                        meowth.setCustomName(chatColorConverter(configuration.getString("ZombieTeamRocket.Meowth name")));
                        Bukkit.getScheduler().cancelTask(processID);
                        break;
                }
                counter++;
            }
        }, 1, 15 * 2);
    }
}
Also used : Entity(org.bukkit.entity.Entity) Ocelot(org.bukkit.entity.Ocelot) Zombie(org.bukkit.entity.Zombie) LeatherArmorMeta(org.bukkit.inventory.meta.LeatherArmorMeta) FixedMetadataValue(org.bukkit.metadata.FixedMetadataValue) ItemStack(org.bukkit.inventory.ItemStack) EventHandler(org.bukkit.event.EventHandler)

Example 35 with FixedMetadataValue

use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.

the class AttackArrow method applyPowers.

@Override
public void applyPowers(Entity entity) {
    entity.setMetadata(powerMetadata, new FixedMetadataValue(plugin, true));
    MinorPowerPowerStance minorPowerPowerStance = new MinorPowerPowerStance();
    minorPowerPowerStance.itemEffect(entity);
}
Also used : FixedMetadataValue(org.bukkit.metadata.FixedMetadataValue) MinorPowerPowerStance(com.magmaguy.elitemobs.powerstances.MinorPowerPowerStance)

Aggregations

FixedMetadataValue (org.bukkit.metadata.FixedMetadataValue)56 MinorPowerPowerStance (com.magmaguy.elitemobs.powerstances.MinorPowerPowerStance)22 Entity (org.bukkit.entity.Entity)10 EventHandler (org.bukkit.event.EventHandler)9 LivingEntity (org.bukkit.entity.LivingEntity)7 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)7 Player (org.bukkit.entity.Player)6 ItemStack (org.bukkit.inventory.ItemStack)6 MajorPowerPowerStance (com.magmaguy.elitemobs.powerstances.MajorPowerPowerStance)4 Item (org.bukkit.entity.Item)4 Zombie (org.bukkit.entity.Zombie)4 Vector (org.bukkit.util.Vector)4 Location (org.bukkit.Location)3 Block (org.bukkit.block.Block)3 IronGolem (org.bukkit.entity.IronGolem)3 PotionEffect (org.bukkit.potion.PotionEffect)3 MyPetPlayer (de.Keyle.MyPet.api.player.MyPetPlayer)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Random (java.util.Random)2