Solved Giving a player potion effects on command

Discussion in 'Plugin Development' started by Minermax7, May 10, 2014.

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


    Hey guys,
    I ran into some trouble, I'm trying to make a quick plugin that makes you invisible on typing a command.. I just don't seem to know to to use the player.addPotionEffects.. I know this is probably super easy to get past but I would still kindly appreciate any help given.

    Kind regards,
  2. Offline


    To add a single potion effect to a specified player, you must simply create an instance of the PotionEffect class:
    1. player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 3*20, 1));

    To add more than one you need to pass in an array of PotionEffects. You're passing in an array of PotionEffectTypes, which the player.addPotionEffects() method does not take. In a similar way to the following, to solve your problem:
    1. player.addPotionEffects(Arrays.asList(new PotionEffect(PotionEffectType.INVISIBILITY, 3*20, 1), /* another potion effect */));
Thread Status:
Not open for further replies.

Share This Page