How to disable the potion effect on hit of a mob like when a cave spider hits you get poison i want to disable that
@Xocky I don't know if there is an easier and better way of doing this but maybe checking if the player was hit by a cave spider then wait a little(so that the player has the effect) and then check if the player has the potion effect and if the player does have it maybe remove it, not sure if it would work but it's just an idea i got, you could also try checking if the player got hit by a cave spider then cancel the event and damage the player(then the player would take damage without getting the effect from being hit by the cave spider) These were 2 ideas i got, i don't know if they would even work and i'm new to this so i can't help you any further, sorry.
I would create a BukkitRunnable executed a tick after the the damage event. In there I would check if the player has the poison effect and then remove it. Do you know how to listen to the EnrityDamageByEntityEvent and how to create a BukkitRunnable?
@KarimAKL the also check if the player has the poison effect when the event fires. Or even save it's duration and compare it a tick later. xoq ǝɥʇ ǝpᴉsʇno ʞuᴉɥʇ
@MightyOne I don't know how i would save the duration and compare it later but thank you for the tips. Also did you copy and paste that "think outside the box" text?
idk if I am allowed to promote websites here. There are many updside-down-text sites on the Internet. http://www.upsidedowntext.com/ Code: PotionEffect effect; if(p.hasPotionEffect(PotionEffectType.POISON)) effect = p.getPotionEffect(PotionEffectType.POISON); BukkitRunnable runnable = new BukkitRunnable() { @Override public void run() { if(p.hasPotionEffect(PotionEffectType.POISON)) { PotionEffect effect2 = p.getPotionEffect(PotionEffectType.POISON); if(effect != null && effect.getDuration() > effect2.getDuration()) return; p.removePotionEffect(PotionEffectType.POISON); p.addPotionEffect(effect); } } }; runnable.runTask(*insert javaplugin reference*); ok i know spoon feeding is barbaric but I think I struggled with potion effects a lot and I'd have prefered someone feeding me like this xD If anybody wants so I will remove it