Zombie spawn potion effect?

Discussion in 'Plugin Development' started by iMurder, Feb 27, 2014.

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

    iMurder

    Alright, So I am trying to achieve a way to give zombies custom potion effects when they spawn from a mob spawner.
    They all have custom names, and I want custom potion effects based off the names.
    This is what I currently have, and I am not sure what I am doing wrong.
    Code:java
    1. @EventHandler
    2. public void onCreatureSpawn(CreatureSpawnEvent event) {
    3. LivingEntity entity = event.getEntity();
    4. EntityType type = event.getEntityType();
    5. String e = event.getEntity().getCustomName();
    6. {
    7. if (event.getEntity() instanceof LivingEntity)
    8. if (type == EntityType.ZOMBIE) {
    9. if (e.equals("Test1")); {
    10. entity.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 2147000, 5));
    11. }
    12. if (e.equals("Test2")); {
    13. entity.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 2147000, 5));
    14. }
    15. if (type == EntityType.VILLAGER) {
    16. event.setCancelled(true); }
    17. }
    18. }


    What am I doing wrong? All help is much appreciated, as I am still learning :D

    Thanks, iMurder.

    Any tips on how to fix this would be highly appreciated. Thanks.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  2. If there is no error popping up then put a message after every line, e.g. (player.sendMessage("1")), this will help to identify the problem line/area because atm i'm not too sure what you've done wrong.
     
  3. Offline

    iMurder

    Thanks, I shall try that now.

    Any chance anyone has any idea what I have done wrong?
    Still no idea..

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  4. Offline

    iMurder

    Please excuse the bump, But I still could not fix this problem :s
     
Thread Status:
Not open for further replies.

Share This Page