Giving a mob/player potion effect

Discussion in 'Plugin Development' started by mike0631, Jul 11, 2012.

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

    mike0631

    I have been trying to figure this out for a couple hours, but it doesnt work.
    Can someone show or make me a code that if you hit a player/mob it is being set on posion for some seconds?

     
  2. player.addPotionEffect()
     
  3. Offline

    EnvisionRed

    Handle an EntityDamageByEntityEvent, if the damager is an instanceof player (and maybe if he has a permission), give the entity a potion effect?
     
  4. Offline

    ProFatal

    So after reading your other post on this and seeing that you cant apply a potion effect to the Entity class you can try
    Code:
    LivingEntity entity = (LivingEntity) event.getEntity();
            entity.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20, 1));
    This casts the entity to a living entity where we add a confusion effect to the entity for 20 ticks which is equal to 1 second.
     
    UltraFireFX likes this.
  5. Offline

    UltraFireFX

    ProFatal Sorry to bump such a old, dusty thread but I don't think making a new one would be as good.
    How can you give an effect forever?
     
  6. Offline

    xTrollxDudex

    UltraFireFX
    No necro please. If you need help, make sure to look around on google, there are a bunch of different threads.
     
  7. Offline

    xigsag

    Or start a new thread. From personal experience, people reply very fast. For example xTrollxDudex .
     
    JPG2000, UltraFireFX and xTrollxDudex like this.
Thread Status:
Not open for further replies.

Share This Page