Datapack with init, tick and second tags, and some hook for detection :
hook-sneak-begin, hook-sneak-end, hook-sneak-second, hook-sneak-tick, hook-swim-begin, hook-swim-end, hook-swim-second, hook-swim-tick, hook-death, hook-respawn, hook-newplayer"