'Minecraft modding my effects are not working

My problem is that like you have seen in the title my effects are not working when I put them on my player This is my code:

@SubscribeEvent
    public void onCopperBlockSneak(InputUpdateEvent event)
    {
        if (event.getMovementInput().sneaking)
        {
            PlayerEntity player = event.getPlayer();

            ItemStack mainHand = player.getHeldItemMainhand();

            BlockPos blockPos = player.getPosition().down();
            BlockState block = player.world.getBlockState(blockPos);

            if (block.getBlock() == ModBlocks.COPPER_BLOCK.get())
            {
                if (mainHand.getItem() == ModItems.COPPER_WIRE.get()) {
                    player.addPotionEffect(new EffectInstance(Effects.STRENGTH, 100));
                    player.addPotionEffect(new EffectInstance(Effects.REGENERATION, 100));
                    player.addPotionEffect(new EffectInstance(Effects.FIRE_RESISTANCE, 100));

                    mainHand.shrink(1);

                    String msg = TextFormatting.RED + "YOU JUST ENTER IN GOD MODE !!!";
                    player.sendMessage(new StringTextComponent(msg), player.getUniqueID());
                }
            }
        }
    }

Can someone help me pls?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source