Spawn Baby Zombie

Discussion in 'Plugin Development' started by Dysthymic, Dec 8, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Dysthymic

    Hello, I'm trying to get baby zombies to spawn. Currently, if string "zombie_swarm_small" is entered in the config, it will spawn about 5-8 zombies. If string "zombie_swarm_big" is entered, it will spawn about 10-15. It works fine, I'm just having difficulty getting them to be babies. How would I set them as a baby? Any help? Thanks!
    Code:
                        if(str.equals("zombie_swarm_small"))
                            spawns(l, EntityType.ZOMBIE);
                        if(str.equals("zombie_swarm_big"))
                            spawnb(l, EntityType.ZOMBIE);
                        
     
  2. Offline

    gomeow

    There is no such thing as a baby zombie. You can make a Villager, Chicken, Cow, Ocelot, Pig, Sheep, Wolf or a Mooshroom a baby.

    To do that:

    Code:java
    1. Villager v = (Villager) world.spawnCreature(location, EntityType.VILLAGER);
    2. v.setBaby(true);
     
  3. There are baby zombies but not in the way you think :3
     
  4. Offline

    Woobie

    There are baby zombies.
    When baby villager gets infected by a zombie, it will turn into a baby zombie.
     
  5. Offline

    Dysthymic

    Unfortunately this spawning method will not work.
    I'm still learning, but I've been working on that method for a while; and it hasn't been working no matter how I change it. The code is a complete mess however, so that may be. I'll work with it a little. Is there another spawning method other than this I can give a try?
     
  6. Offline

    gomeow

    Here is another attempt at it:

    Code:java
    1. EntityZombie ez = (EntityZombie) world.spawnCreature(loc, EnitityType.ZOMBIE).setVillager(true).setBaby(true);

    You will need to reference CraftBukkit for this. I haven't tested this yet, so I'm not sure if it will work.
     
  7. Offline

    youngbawss22

    This link may help you. I was curious to see if this was possible so i looked it up and this it what i saw.
     
  8. Offline

    Dysthymic

    Code:
    if(str.equals("zombiebaby_swarm_small"))
                            spawns(l, EntityType.ZOMBIE);
                        if(str.equals("zombiebaby_swarm_big"))
                            spawnb(l, EntityType.ZOMBIE);
                        Zombie z = (Zombie) l.getWorld().spawnEntity(l.getLocation(), EntityType.ZOMBIE);
                        z.setBaby(true);
    This works... kind of. It spawns only one baby zombie, the rest are normal zombies. How would I make all of the spawned zombies into babies?
     
  9. Offline

    lenis0012

    You will need to import the CraftBukkit.jar as well for this to work:
    Code:
    CraftZombie zombie = (CraftZombie)world.spawn(loc, Zombie.class);
    zombie.setBaby(true);
    
     
  10. Offline

    Dysthymic

    Code:
        public void spawns(LivingEntity l, EntityType t)
        {
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
        }
        public void spawnb(LivingEntity l, EntityType t)
        {
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
            l.getWorld().spawnEntity(l.getLocation(), t);
        }
    Do I need to create:
    Code:
     Zombie z = (Zombie) l.getWorld().spawnEntity(l.getLocation(), EntityType.ZOMBIE);
                        z.setBaby(true);
    for all of the l.getWorld().spawnEntity(l.getLocation(), t); 's?? Because it only spawns one baby zombie from that; the rest are normal zombies.
     
  11. Offline

    gomeow

    You know, you could just do a for loop to do that:
    Code:java
    1. for(i = 0; i < /*Amount of times spawned here*/; i++) {
    2. CraftZombie cz = (CraftZombie) l.getWorld().spawn(l.getLocation, Zombie.class);
    3. cz.setBaby(true);
    4. }
     
  12. Offline

    Dysthymic

    I'm lost on what I would replace the variable "i" with. I use it, and it is an unknown variable. I'm still learning.
     
  13. Offline

    gomeow

    Why would you replace it? The i is initialized in the first part of the for statement?

    also, add the word "int" before i = 0. sorry about that (My mind was thinking around python for a sec)

    Here is a link: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html
     
  14. Offline

    Dysthymic

    Thanks! It works.. sort of.
    I have made two uses of that code, and once I use two used of that code; it no longer works. It spawns ONE instead of 5 or 10. Any idea what I'm doing wrong? When I use that code once, it works fine. But I need it multiple times, as seen below.
    Code:
    if(str.equals("zombie_swarm_small"))
                        spawns(l, EntityType.ZOMBIE);
                        for(int i = 0; i < 5; i++) {
                        CraftZombie cz = (CraftZombie) l.getWorld().spawn(l.getLocation(), Zombie.class);
                        cz.addPotionEffect(null);
                        }
                        if(str.equals("zombie_swarm_big"))
                        spawnb(l, EntityType.ZOMBIE);
                        for(int i = 0; i < 10; i++) {
                        CraftZombie cz = (CraftZombie) l.getWorld().spawn(l.getLocation(), Zombie.class);
                        cz.addPotionEffect(null);
                        }
     
  15. Offline

    gomeow

    The code could look a bit different if you aren't changing them to babies.
    Code:
    for(int i = 0; i < 5; i++) {
        l.getWorld().spawnEntity(l.getLocation(), EntityType.ZOMBIE).addPotionEffect(PotionEffect pe);
    }
     
  16. Offline

    Dysthymic

    Wouldn't work in this situation, with (PotionEffect pe)
    I suppose it would be more helpful if I included more code including what spawnb and spawns contains and whatnot. They had spawning methods in them, but I had to take them out because it was multiplying them.
    I'm trying to summon multiple kinds of mobs. The previous method wouldn't work for babies, so I had to change it all together. This current method requires I have a something for a line for regular mobs; so I chose a null potion effect. See anything wrong with this?
    Code:
                        if(str.equals("poison_short"))
                            poisons(l,PotionEffectType.POISON,140);
                        if(str.equals("poison_long"))                       
                            poisons(l,PotionEffectType.POISON,500);
                       
                        if(str.equals("blindness_short"))
                            poisons(l,PotionEffectType.BLINDNESS,140);
                        if(str.equals("blindness_long"))       
                            poisons(l,PotionEffectType.BLINDNESS,500);
                       
                        if(str.equals("weakness_short"))
                            poisons(l,PotionEffectType.WEAKNESS,140);
                        if(str.equals("weakness_long"))       
                            poisons(l,PotionEffectType.WEAKNESS,500);
                       
                        if(str.equals("slow_short"))
                            poisons(l,PotionEffectType.SLOW,140);
                        if(str.equals("slow_long"))       
                            poisons(l,PotionEffectType.SLOW,500);
                       
                        if(str.equals("hunger_short"))
                            poisons(l,PotionEffectType.HUNGER,140);
                        if(str.equals("hunger_long"))       
                            poisons(l,PotionEffectType.HUNGER,500);
                       
                        if(str.equals("confusion_short"))
                            poisons(l,PotionEffectType.CONFUSION,140);
                        if(str.equals("confusion_long"))
                            poisons(l,PotionEffectType.CONFUSION,500);
                       
                        if(str.equals("zombie_swarm_small"))
                        spawns(l, EntityType.ZOMBIE);
                        for(int i = 0; i < 5; i++) {
                        CraftZombie cz = (CraftZombie) l.getWorld().spawn(l.getLocation(), Zombie.class);
                        cz.addPotionEffect(null);
                        }
                        if(str.equals("zombie_swarm_big"))
                        spawnb(l, EntityType.ZOMBIE);
                        for(int i = 0; i < 10; i++) {
                        CraftZombie cz = (CraftZombie) l.getWorld().spawn(l.getLocation(), Zombie.class);
                        cz.addPotionEffect(null);
                        }
                       
                        if(str.equals("spider_swarm_small"))
                            spawns(l, EntityType.SPIDER);
                        for(int i = 0; i < 5; i++) {
                            CraftSpider cs = (CraftSpider) l.getWorld().spawn(l.getLocation(), Spider.class);
                            cs.addPotionEffect(null);
                            }
                        if(str.equals("spider_swarm_big"))
                            spawnb(l, EntityType.SPIDER);
                        for(int i = 0; i < 10; i++) {
                            CraftSpider cs = (CraftSpider) l.getWorld().spawn(l.getLocation(), Spider.class);
                            cs.addPotionEffect(null);
                            }
                       
                        if(str.equals("silverfish_swarm_small"))
                            spawns(l, EntityType.SILVERFISH);
                        for(int i = 0; i < 5; i++) {
                            CraftSilverfish cs = (CraftSilverfish) l.getWorld().spawn(l.getLocation(), Silverfish.class);
                            cs.addPotionEffect(null);
                            }
                        if(str.equals("silverfish_swarm_big"))
                            spawnb(l, EntityType.SILVERFISH);
                        for(int i = 0; i < 10; i++) {
                            CraftSilverfish cs = (CraftSilverfish) l.getWorld().spawn(l.getLocation(), Silverfish.class);
                            cs.addPotionEffect(null);
                            }
                       
                        if(str.equals("snowman_swarm_small"))
                            spawns(l, EntityType.SNOWMAN);
                        for(int i = 0; i < 5; i++) {
                            CraftSnowman cs = (CraftSnowman) l.getWorld().spawn(l.getLocation(), Snowman.class);
                            cs.addPotionEffect(null);
                            }
                        if(str.equals("snowman_swarm_big"))
                            spawnb(l, EntityType.SNOWMAN);
                        for(int i = 0; i < 10; i++) {
                            CraftSnowman cs = (CraftSnowman) l.getWorld().spawn(l.getLocation(), Snowman.class);
                            cs.addPotionEffect(null);
                            }
                       
                        if(str.equals("pigzombie_swarm_small"))
                            spawns(l, EntityType.PIG_ZOMBIE);
                        for(int i = 0; i < 5; i++) {
                            CraftPigZombie pz = (CraftPigZombie) l.getWorld().spawn(l.getLocation(), PigZombie.class);
                            pz.addPotionEffect(null);
                            }
                        if(str.equals("pigzombie_swarm_big"))
                            spawnb(l, EntityType.PIG_ZOMBIE);
                        for(int i = 0; i < 10; i++) {
                            CraftPigZombie pz = (CraftPigZombie) l.getWorld().spawn(l.getLocation(), PigZombie.class);
                            pz.addPotionEffect(null);
                            }
                       
                        if(str.equals("pigzombiebaby_swarm_small"))
                            spawns(l, EntityType.PIG_ZOMBIE);
                        for(int i = 0; i < 5; i++) {
                            CraftPigZombie pz = (CraftPigZombie) l.getWorld().spawn(l.getLocation(), PigZombie.class);
                            pz.setBaby(true);
                            }
                        if(str.equals("pigzombibabye_swarm_big"))
                            spawnb(l, EntityType.PIG_ZOMBIE);
                        for(int i = 0; i < 10; i++) {
                            CraftPigZombie pz = (CraftPigZombie) l.getWorld().spawn(l.getLocation(), PigZombie.class);
                            pz.setBaby(true);
                            }
                       
                        if(str.equals("blaze_swarm_small"))
                            spawns(l, EntityType.BLAZE);
                        for(int i = 0; i < 5; i++) {
                            CraftBlaze cb = (CraftBlaze) l.getWorld().spawn(l.getLocation(), Blaze.class);
                            cb.addPotionEffect(null);
                            }
                        if(str.equals("blaze_swarm_big"))
                            spawnb(l, EntityType.BLAZE);
                        for(int i = 0; i < 10; i++) {
                            CraftBlaze cb = (CraftBlaze) l.getWorld().spawn(l.getLocation(), Blaze.class);
                            cb.addPotionEffect(null);
                            }
                       
                        if(str.equals("skeleton_swarm_small"))
                            spawns(l, EntityType.SKELETON);
                        for(int i = 0; i < 5; i++) {
                            CraftSkeleton cs = (CraftSkeleton) l.getWorld().spawn(l.getLocation(), Skeleton.class);
                            cs.addPotionEffect(null);
                            }
                        if(str.equals("skeleton_swarm_big"))
                            spawnb(l, EntityType.SKELETON);
                        for(int i = 0; i < 10; i++) {
                            CraftSkeleton cs = (CraftSkeleton) l.getWorld().spawn(l.getLocation(), Skeleton.class);
                            cs.addPotionEffect(null);
                            }
                       
                        if(str.equals("zombiebaby_swarm_small"))
                            spawns(l, EntityType.ZOMBIE);
                        for(int i = 0; i < 5; i++) {
                            CraftZombie cz = (CraftZombie) l.getWorld().spawn(l.getLocation(), Zombie.class);
                            cz.setBaby(true);
                            }
                        if(str.equals("zombiebaby_swarm_big"))
                            spawnb(l, EntityType.ZOMBIE);
                        for(int i = 0; i < 10; i++) {
                            CraftZombie cz = (CraftZombie) l.getWorld().spawn(l.getLocation(), Zombie.class);
                            cz.setBaby(true);
                            }
                       
                        if(str.equals("wither_short"))
                            poisons(l,PotionEffectType.WITHER,140);
                        if(str.equals("wither_long"))
                            poisons(l,PotionEffectType.WITHER,500);
                        number++;
                       
                    }
                    else
                    {
                        number++;
                    }
                }
            }
        }
        public void teleport(LivingEntity l, Player p)
        {
            l.teleport(p.getLocation());
        }
        public void dragin(LivingEntity l)
        {
            for (Player player: Bukkit.getServer().getOnlinePlayers())
            {
                if(l.getWorld() == player.getWorld())
                {
                    if(l.getLocation().distance(player.getLocation()) <= 20)
                    {
                        player.teleport(l.getLocation());
                    }
                }
            }
        }
        public void swap(LivingEntity l, Player p)
        {
            Location lo = l.getLocation();
            l.teleport(p.getLocation());
            p.teleport(lo);
        }
        public void lightning(LivingEntity l)
        {
            for (Player player: Bukkit.getServer().getOnlinePlayers())
            {
                if(l.getWorld() == player.getWorld())
                {
                    if(l.getLocation().distance(player.getLocation()) <= 20)
                    {
                        player.getWorld().strikeLightning(player.getLocation());
                    }
                }
            }
        }
        public void fires(LivingEntity l)
        {
            for (Player player: Bukkit.getServer().getOnlinePlayers())
            {
                if(l.getWorld() == player.getWorld())
                {
                    if(l.getLocation().distance(player.getLocation()) <= 20)
                    {
                        player.setFireTicks(140);
                    }
                }
            }
        }
        public void firel(LivingEntity l)
        {
            for (Player player: Bukkit.getServer().getOnlinePlayers())
            {
                if(l.getWorld() == player.getWorld())
                {
                    if(l.getLocation().distance(player.getLocation()) <= 20)
                    {
                        player.setFireTicks(500);
                    }
                }
            }
        }
        public void poisons(LivingEntity l, PotionEffectType p, int q)
        {
            for (Player player: Bukkit.getServer().getOnlinePlayers())
            {
                if(l.getWorld() == player.getWorld())
                {
                    if(l.getLocation().distance(player.getLocation()) <= 20)
                    {
                        player.addPotionEffect(new PotionEffect(p, q, 2));
                    }
                }
            }
        }
        public void spawns(LivingEntity l, EntityType t)
        {
     
        }
        public void spawnb(LivingEntity l, EntityType t)
        {
     
        }
    }
    
     
  17. Offline

    gomeow

    why do you add a potion effect of null?
    And like I said, if you aren't making them babies or some other special function, use my spawning method above using the normal api
     
  18. Offline

    Dysthymic

    Okay, i used the normal API like you said. Now we've ran into another problem unfortunately.
    ALL of the mobs are spawned. So (5+10) 15 of each mob is being spawned because of one "skill" string being used: zombie_swarm_small, when only the zombie_swarm_small should be being used.
    Code:
        * ################################################################################
        * #                                                                              #
        * #                                SKILLS!                                      #
        * #                                                                              #
        * ################################################################################
        */
        public void skillexec(LivingEntity l, Player p)
        {
            plugin.Skills(l);
            String s = plugin.getCustomConfig(plugin.file).getString("mobs." + l.getEntityId() + ".Name");
            int random = plugin.getConfig().getInt("Bosses." + s + ".SkillsInterval");
            if((int) (Math.random()*random) == 0)
            {
                int cskills = plugin.skills.size();
                int selected = (int) (Math.random()*cskills);
                int number = 0;
                for(String str: plugin.skills)
                {
                    if(selected == number)
                    {
                        SkillMsg(l, p);
                        if(str.equals("teleport"))
                            teleport(l,p);
                        if(str.equals("swap"))
                            swap(l,p);
                        if(str.equals("drag_in"))
                            dragin(l);
                        if(str.equals("lightning"))
                            lightning(l);
                     
                        if(str.equals("poison_short"))
                            poisons(l,PotionEffectType.POISON,140);
                        if(str.equals("poison_long"))                     
                            poisons(l,PotionEffectType.POISON,500);
                     
                        if(str.equals("blindness_short"))
                            poisons(l,PotionEffectType.BLINDNESS,140);
                        if(str.equals("blindness_long"))     
                            poisons(l,PotionEffectType.BLINDNESS,500);
                     
                        if(str.equals("weakness_short"))
                            poisons(l,PotionEffectType.WEAKNESS,140);
                        if(str.equals("weakness_long"))     
                            poisons(l,PotionEffectType.WEAKNESS,500);
                     
                        if(str.equals("slow_short"))
                            poisons(l,PotionEffectType.SLOW,140);
                        if(str.equals("slow_long"))     
                            poisons(l,PotionEffectType.SLOW,500);
                     
                        if(str.equals("hunger_short"))
                            poisons(l,PotionEffectType.HUNGER,140);
                        if(str.equals("hunger_long"))     
                            poisons(l,PotionEffectType.HUNGER,500);
                     
                        if(str.equals("confusion_short"))
                            poisons(l,PotionEffectType.CONFUSION,140);
                        if(str.equals("confusion_long"))
                            poisons(l,PotionEffectType.CONFUSION,500);
                     
                        if(str.equals("zombie_swarm_small"))
                        spawns(l, EntityType.ZOMBIE);
                        for(int i = 0; i < 5; i++) {
                            l.getWorld().spawnEntity(l.getLocation(), EntityType.ZOMBIE);
                        }
                        if(str.equals("zombie_swarm_big"))
                        spawnb(l, EntityType.ZOMBIE);
                        for(int i = 0; i < 10; i++) {
                            l.getWorld().spawnEntity(l.getLocation(), EntityType.ZOMBIE);
                        }
                     
                        if(str.equals("spider_swarm_small"))
                            spawns(l, EntityType.SPIDER);
                        for(int i = 0; i < 5; i++) {
                            l.getWorld().spawnEntity(l.getLocation(), EntityType.SPIDER);
                        }
                            }
                        if(str.equals("spider_swarm_big"))
                            spawnb(l, EntityType.SPIDER);
                        for(int i = 0; i < 10; i++) {
                            l.getWorld().spawnEntity(l.getLocation(), EntityType.SPIDER);
                        }
                     
                        if(str.equals("silverfish_swarm_small"))
                            spawns(l, EntityType.SILVERFISH);
                        for(int i = 0; i < 5; i++) {
                            l.getWorld().spawnEntity(l.getLocation(), EntityType.SILVERFISH);
                        }
                        if(str.equals("silverfish_swarm_big"))
                            spawnb(l, EntityType.SILVERFISH);
                        for(int i = 0; i < 10; i++) {
                            l.getWorld().spawnEntity(l.getLocation(), EntityType.SILVERFISH);
                        }
                     
                        if(str.equals("snowman_swarm_small"))
                            spawns(l, EntityType.SNOWMAN);
                        for(int i = 0; i < 5; i++) {
                            l.getWorld().spawnEntity(l.getLocation(), EntityType.SNOWMAN);
                        }
                        if(str.equals("snowman_swarm_big"))
                            spawnb(l, EntityType.SNOWMAN);
                        for(int i = 0; i < 10; i++) {
                            l.getWorld().spawnEntity(l.getLocation(), EntityType.SNOWMAN);
                        }
                     
                        if(str.equals("pigzombie_swarm_small"))
                            spawns(l, EntityType.PIG_ZOMBIE);
                        for(int i = 0; i < 5; i++) {
                            l.getWorld().spawnEntity(l.getLocation(), EntityType.PIG_ZOMBIE);
                        }
                        if(str.equals("pigzombie_swarm_big"))
                            spawnb(l, EntityType.PIG_ZOMBIE);
                        for(int i = 0; i < 10; i++) {
                            l.getWorld().spawnEntity(l.getLocation(), EntityType.PIG_ZOMBIE);
                        }
                     
                        if(str.equals("pigzombiebaby_swarm_small"))
                            spawns(l, EntityType.PIG_ZOMBIE);
                        for(int i = 0; i < 5; i++) {
                            CraftPigZombie pz = (CraftPigZombie) l.getWorld().spawn(l.getLocation(), PigZombie.class);
                            pz.setBaby(true);
                            }
                        if(str.equals("pigzombiebaby_swarm_big"))
                            spawnb(l, EntityType.PIG_ZOMBIE);
                        for(int i = 0; i < 10; i++) {
                            CraftPigZombie pz = (CraftPigZombie) l.getWorld().spawn(l.getLocation(), PigZombie.class);
                            pz.setBaby(true);
                            }
                     
                        if(str.equals("blaze_swarm_small"))
                            spawns(l, EntityType.BLAZE);
                        for(int i = 0; i < 5; i++) {
                            l.getWorld().spawnEntity(l.getLocation(), EntityType.BLAZE);
                        }
                        if(str.equals("blaze_swarm_big"))
                            spawnb(l, EntityType.BLAZE);
                        for(int i = 0; i < 10; i++) {
                            l.getWorld().spawnEntity(l.getLocation(), EntityType.BLAZE);
                        }
                     
                        if(str.equals("skeleton_swarm_small"))
                            spawns(l, EntityType.SKELETON);
                        for(int i = 0; i < 5; i++) {
                            l.getWorld().spawnEntity(l.getLocation(), EntityType.SKELETON);
                        }
                        if(str.equals("skeleton_swarm_big"))
                            spawnb(l, EntityType.SKELETON);
                        for(int i = 0; i < 10; i++) {
                            l.getWorld().spawnEntity(l.getLocation(), EntityType.SKELETON);
                        }
                     
                        if(str.equals("zombiebaby_swarm_small"))
                            spawns(l, EntityType.ZOMBIE);
                        for(int i = 0; i < 5; i++) {
                            CraftZombie cz = (CraftZombie) l.getWorld().spawn(l.getLocation(), Zombie.class);
                            cz.setBaby(true);
                            }
                        if(str.equals("zombiebaby_swarm_big"))
                            spawnb(l, EntityType.ZOMBIE);
                        for(int i = 0; i < 10; i++) {
                            CraftZombie cz = (CraftZombie) l.getWorld().spawn(l.getLocation(), Zombie.class);
                            cz.setBaby(true);
                            }
                     
                        if(str.equals("wither_short"))
                            poisons(l,PotionEffectType.WITHER,140);
                        if(str.equals("wither_long"))
                            poisons(l,PotionEffectType.WITHER,500);
                        number++;
                     
                    }
                }
            }
     
     
        public void teleport(LivingEntity l, Player p)
        {
            l.teleport(p.getLocation());
        }
        public void dragin(LivingEntity l)
        {
            for (Player player: Bukkit.getServer().getOnlinePlayers())
            {
                if(l.getWorld() == player.getWorld())
                {
                    if(l.getLocation().distance(player.getLocation()) <= 20)
                    {
                        player.teleport(l.getLocation());
                    }
                }
            }
        }
        public void swap(LivingEntity l, Player p)
        {
            Location lo = l.getLocation();
            l.teleport(p.getLocation());
            p.teleport(lo);
        }
        public void lightning(LivingEntity l)
        {
            for (Player player: Bukkit.getServer().getOnlinePlayers())
            {
                if(l.getWorld() == player.getWorld())
                {
                    if(l.getLocation().distance(player.getLocation()) <= 20)
                    {
                        player.getWorld().strikeLightning(player.getLocation());
                    }
                }
            }
        }
        public void fires(LivingEntity l)
        {
            for (Player player: Bukkit.getServer().getOnlinePlayers())
            {
                if(l.getWorld() == player.getWorld())
                {
                    if(l.getLocation().distance(player.getLocation()) <= 20)
                    {
                        player.setFireTicks(140);
                    }
                }
            }
        }
        public void firel(LivingEntity l)
        {
            for (Player player: Bukkit.getServer().getOnlinePlayers())
            {
                if(l.getWorld() == player.getWorld())
                {
                    if(l.getLocation().distance(player.getLocation()) <= 20)
                    {
                        player.setFireTicks(500);
                    }
                }
            }
        }
        public void poisons(LivingEntity l, PotionEffectType p, int q)
        {
            for (Player player: Bukkit.getServer().getOnlinePlayers())
            {
                if(l.getWorld() == player.getWorld())
                {
                    if(l.getLocation().distance(player.getLocation()) <= 20)
                    {
                        player.addPotionEffect(new PotionEffect(p, q, 2));
                    }
                }
            }
        }
        public void spawns(LivingEntity l, EntityType t)
        {
     
        }
        public void spawnb(LivingEntity l, EntityType t)
        {
     
        }
    }
    
     
Thread Status:
Not open for further replies.

Share This Page