Adding effects

Discussion in 'Plugin Development' started by Amrefinium, Jul 15, 2013.

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

    Amrefinium

    hi, i was woundering if you could help me with a slight problem ive encountered in my code??

    i cant seem to figure out what code i need, i want to add the nausea effect to the player after teleporting

    this is the code i have so far
    Code:
    if(blockId == 345){
                Block block = player.getTargetBlock(null, 200);
                Location teleportLoc = block.getLocation();
                teleportLoc.setY(teleportLoc.getY() + 1.5);
                player.teleport(teleportLoc);
    im useing an eventhandeler for this section, if you could help that would be great, thanks
     
  2. Offline

    Gigi10012

    add this:
    Code:java
    1. int duration = 10;
    2. int amplifier = 10;
    3. PotionEffect effect = new PotionEffect(PotionEffectType.CONFUSION, duration, amplifier);
    4. player.addPotionEffect(effect);


    like this:
    Code:java
    1. if(blockId == 345){
    2. Block block = player.getTargetBlock(null, 200);
    3. Location teleportLoc = block.getLocation();
    4. teleportLoc.setY(teleportLoc.getY() + 1.5);
    5. player.teleport(teleportLoc);
    6. int duration = 10;
    7. int amplifier = 10;
    8. PotionEffect effect = new PotionEffect(PotionEffectType.CONFUSION, duration, amplifier);
    9. player.addPotionEffect(effect);
     
  3. Offline

    soulofw0lf

    Code:java
    1. if(blockId == 345){
    2. Block block = player.getTargetBlock(null, 200);
    3. Location teleportLoc = block.getLocation();
    4. teleportLoc.setY(teleportLoc.getY() + 1.5);
    5. player.teleport(teleportLoc);
    6. player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 10, 10));
    7.  

    simplified a bit from that.
     
  4. Offline

    Amrefinium

    thanks for helping me, really appreciate it :)
     
Thread Status:
Not open for further replies.

Share This Page