Solved Code not working

Discussion in 'Plugin Development' started by Newby, Sep 20, 2013.

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

    Newby

    Trying to give players strength and speed if there in the water but it doesn't give them any potion effects. My code:
    Code:java
    1. @EventHandler
    2. public void playerMove(PlayerMoveEvent e){
    3. Player p = e.getPlayer();
    4. Location loc = p.getLocation();
    5. if(Main.mist.contains(p.getName())){
    6. if(loc.getBlock() == new ItemStack(Material.WATER)){
    7. p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 20 , 1));
    8. p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20 , 1));
    9. }
    10. }
    11. }
     
  2. Offline

    xxMOxMOxx


    Code:
    @EventHandler
        public void playerMove(PlayerMoveEvent e){
            Player p = e.getPlayer();
            Location loc = p.getLocation();
            if(Main.mist.contains(p.getName())){
                if(loc.getBlock().getType() == Material.WATER){
                    p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 20 , 1));
                    p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20 , 1));
                }
            }
        }
    I think that should work
     
  3. Offline

    Newby

    It worked, thank you :p
     
Thread Status:
Not open for further replies.

Share This Page