@Override
public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult)
{
if(!level.isClientSide&&hand == InteractionHand.MAIN_HAND)
{
boolean lit = state.getValue(LIT);
if (lit) {
new Thread(() -> {
player.hurt(DamageSource.LIGHTNING_BOLT, 2);
level.setBlock(pos, state.cycle(LIT), 3);
try {
Thread.sleep(300);
}catch (Exception e){}
level.setBlock(pos, state.cycle(LIT), 3);
}).start();
}
}
return super.use(state, level, pos, player, hand, hitResult);
}
i`m sory