I tried to do something with the code you gave me, but every time I use the item, I just take damage, with or without the potion effect. Here is the bottom portion of code for my Ibuprofen item.
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
itemstack.damageItem(1, entityplayer);
entityplayer.addPotionEffect((new PotionEffect(RandomC.Ibp.getId(), 5, 0)));
if (entityplayer.isPotionActive(RandomC.Ibp));
entityplayer.attackEntityFrom(DamageSource.causePlayerDamage(entityplayer), 5);
if (entityplayer.prevHealth >= 20) return itemstack;
entityplayer.heal(healAmount);
return itemstack;