execute as @a at @s if block ~ ~ ~ #beds run gamerule doDaylightCycle false
execute as @a at @s unless block ~ ~ ~ #beds run gamerule doDaylightCycle true
execute as @a[nbt={SelectedItem:{id:"minecraft:diamond",Count:1b}}] at @s run effect give @s speed 1 2 true (цикличный, всегда активный)
берёшь в руки ОДИН алмаз и ты ускоряешься