1.16.5 Potion Effects Wrong level

Discussion in 'Spigot Plugin Development' started by Scriviotic, Feb 26, 2021.

  1. When I attempt to give a player a potion effect, it gives the highest amplifier of the effect instead of the one I specify.

    For example, instead of this giving strength one, it gives strength two:
    Code (Java):
    player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200, 1));
    Is there another way of doing it or am I doing it wrong?
     
  2. The amplifier starts at 0, not 1. So if you want Strength I, you have to set that value to 0
     
  3. oh yeah I totally forgot java does that lol.
     
  4. First it's not java, it's just how minecraft handles them. And usually all counts start from 0
     
    #4 TSEngineer, Feb 27, 2021
    Last edited: Feb 27, 2021
  5. Nah its a bit weird they do them like this. Usually it only starts from 0 if its array based
     
    • Like Like x 1