Strength II Fix

Discussion in 'Plugin Development' started by snake4212, Apr 30, 2014.

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

    snake4212

    So basically I am making a plugin so when someone drinks Strength II or has it in general it changes it to strength 1 8 mins
    This is what I have so far but I have no idea how to go about making it so it detects that it has strength 2 instead of just strength and then making it strength 8 mins
    Code:
    for (Player player : Bukkit.getServer().getOnlinePlayers()) {;
     
    if (player.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) {
    player.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
    
     
  2. Offline

    coasterman10

    Get their potion effects with player.getActivePotionEffects(). It is a Collection<PotionEffect>. You can iterate over all of them, check if one is a strength effect, then check the amplifier of the potion effect from that effect. (Strength 2 has amplifier of 1)
     
  3. Offline

    GeorgeeeHD

    snake4212 I would use a PlayerItemConsumeEvent or something like that. Then check if they have a potion and if it is strength 2, then remove that potion and add a custom potion that you want, eg, strength 1 for 8mins
     
Thread Status:
Not open for further replies.

Share This Page