execute as @p at @s if blocks ~~1~ ~~20~ ~~~ masked run tag @s remove NP
execute as @p at @s unless blocks ~~1~ ~~20~ ~~~ masked run tag @s add NP
execute as @p[tag=NP] at @s if blocks ~-1~1~1 ~-1~2~1 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~-1~1~1 ~-1~2~1 ~~~ masked if blocks ~-1~2~1 ~-1~3~1 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~-1~1~1 ~-1~2~1 ~~~ masked if blocks ~-1~2~1 ~-1~3~1 ~~~ masked if blocks ~-1~3~1 ~-1~4~1 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~-1~1~1 ~-1~2~1 ~~~ masked if blocks ~-1~2~1 ~-1~3~1 ~~~ masked if blocks ~-1~3~1 ~-1~4~1 ~~~ masked if blocks ~-1~4~1 ~-1~5~1 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~-1~5~1 ~-1~20~1 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~1~1~-1 ~1~2~-1 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~1~1~-1 ~1~2~-1 ~~~ masked if blocks ~1~2~-1 ~1~3~-1 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~1~1~-1 ~1~2~-1 ~~~ masked if blocks ~1~2~-1 ~1~3~-1 ~~~ masked if blocks ~1~3~-1 ~1~4~-1 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~1~1~-1 ~1~2~-1 ~~~ masked if blocks ~1~2~-1 ~1~3~-1 ~~~ masked if blocks ~1~3~-1 ~1~4~-1 ~~~ masked if blocks ~1~4~-1 ~1~5~-1 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~1~5~-1 ~1~20~-1 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s unless blocks ~-1~1~1 ~-1~2~1 ~~~ masked unless blocks ~-1~2~1 ~-1~3~1 ~~~ masked unless blocks ~-1~3~1 ~-1~4~1 ~~~ masked unless blocks ~-1~4~1 ~-1~5~1 ~~~ masked unless blocks ~-1~5~1 ~-1~20~1 ~~~ masked unless blocks ~1~1~-1 ~1~2~-1 ~~~ masked unless blocks ~1~2~-1 ~1~3~-1 ~~~ masked unless blocks ~1~3~-1 ~1~4~-1 ~~~ masked unless blocks ~1~4~-1 ~1~5~-1 ~~~ masked unless blocks ~1~5~-1 ~1~20~-1 ~~~ masked run tag @s add SH
execute as @p[tag=NP,tag=SH] at @s anchored feet if blocks ~~~-2 ~~~-8 ~~~ masked run tag @s remove SP
execute as @p[tag=NP,tag=SH] at @s anchored feet if blocks ~~~2 ~~~8 ~~~ masked run tag @s remove SP
execute as @p[tag=NP,tag=SH] at @s anchored feet if blocks ~-2~~ ~-8~~ ~~~ masked run tag @s remove SP
execute as @p[tag=NP,tag=SH] at @s anchored feet if blocks ~2~~ ~8~~ ~~~ masked run tag @s remove SP
execute as @p[tag=NP,tag=SH] at @s anchored feet unless blocks ~~~-2 ~~~-8 ~~~ masked unless blocks ~~~2 ~~~8 ~~~ masked unless blocks ~-2~~ ~-8~~ ~~~ masked unless blocks ~2~~ ~8~~ ~~~ masked run tag @s add SP
execute as @p[tag=!NP] run tag @s remove SH
execute as @p[tag=!NP] run tag @s remove SP
execute as @p[tag=!SH] run tag @s remove SP
execute as @p[m=survival] run tag @s add SM
execute as @p[m=adventure] run tag @s add AM
execute as @p[m=!survival] run tag @s remove SM
execute as @p[m=!adventure] run tag @s remove AM
execute as @p[m=survival,tag=!PAPC,tag=!PAPCS] run tag @s remove BO
execute as @p[m=adventure,tag=!PAPC,tag=!PAPCS] run tag @s remove BO
execute as @p[m=creative,tag=!PAPC,tag=!PAPCS] run tag @s add BO
execute as @p[m=spectator] run tag @s add IS
execute as @p[m=!spectator] run tag @s remove IS
execute as @p[tag=BO] run tag @s remove OG
execute as @p[tag=BO] run tag @s remove ALD
execute as @p[tag=IS] run tag @s remove OG
execute as @p[tag=IS] run tag @s remove ALD
execute as @p[tag=PAC] run tag @s remove BO
execute as @p[tag=PACS] run tag @s remove BO
execute as @p[tag=PAS,m=survival] run tag @s add PAPS
execute as @p[tag=PAS,m=adventure] run tag @s add PAPS
execute as @p[tag=PAS,tag=!SM,tag=!AM] run tag @s remove PAPS
execute as @p[tag=PAC,m=creative] run tag @s add PAPC
execute as @p[tag=PAC,m=!creative] run tag @s remove PAPC
execute as @p[tag=!PAS] run tag @s remove PAPS
execute as @p[tag=!PAC] run tag @s remove PAPC
execute as @p[tag=PASS,m=survival] run tag @s add PAPSS
execute as @p[tag=PASS,m=adventure] run tag @s add PAPSS
execute as @p[tag=PASS,tag=!SM,tag=!AM] run tag @s remove PAPSS
execute as @p[tag=PACS,m=creative] run tag @s add PAPCS
execute as @p[tag=PACS,m=!creative] run tag @s remove PAPCS
execute as @p[tag=!PASS] run tag @s remove PAPSS
execute as @p[tag=!PACS] run tag @s remove PAPCS
execute as @p[tag=RL,tag=CI] run inputpermission set @s movement disabled
execute as @p[tag=!RL,tag=!PD,tag=!LD,tag=CI] run inputpermission set @s movement enabled
execute as @p[tag=PD,tag=CI] run inputpermission set @s movement disabled
execute as @p[tag=!PD,tag=!RL,tag=!LD,tag=CI] run inputpermission set @s movement enabled
execute as @p[tag=LD,tag=CI] run inputpermission set @s movement disabled
execute as @p[tag=!LD,tag=!RL,tag=!PD,tag=CI] run inputpermission set @s movement enabled
execute as @p[tag=!IS,tag=!BO,tag=!ResetTick,haspermission={movement=enabled}] run scoreboard players add @s TickTime 1
execute as @p[tag=!IS,tag=!BO,tag=ResetTick,scores={TickTime=!1000},haspermission={movement=enabled}] run scoreboard players add @s TickTime 1
execute as @p[tag=!IS,tag=!BO,scores={TickTime=500..},haspermission={movement=enabled}] run tag @s add ResetTick
execute as @p[tag=!IS,tag=!BO,tag=ResetTick,scores={TickTime=600..,TickTime=..700},haspermission={movement=enabled}] run tag @s remove RL
execute as @p[tag=!IS,tag=!BO,tag=ResetTick,scores={TickTime=700..,TickTime=..800},haspermission={movement=enabled}] run tag @s remove RL
execute as @p[tag=!IS,tag=!BO,tag=ResetTick,scores={TickTime=800..,TickTime=..900},haspermission={movement=enabled}] run tag @s remove RL
execute as @p[tag=!IS,tag=!BO,tag=ResetTick,scores={TickTime=1000},haspermission={movement=enabled}] run scoreboard players set @s TickTime 0
execute as @p[tag=!IS,tag=!BO,tag=ResetTick,scores={TickTime=0..,TickTime=..500},haspermission={movement=enabled}] run tag @s remove ResetTick
execute as @p[tag=IS,tag=RL] run tag @s remove RL
execute as @p[tag=BO,tag=RL] run tag @s remove RL
execute as @p[tag=RL] run tag @s add CI
execute as @p[tag=CI,scores={TickFlight=500}] run tag @s remove CI
execute as @p[tag=!OG,tag=!ALD,tag=CI,tag=!ResetTF] run scoreboard players add @s TickFlight 1
execute as @p[tag=!OG,tag=!ALD,tag=CI,tag=ResetTF,scores={TickFlight=!500}] run scoreboard players add @s TickFlight 1
execute as @p[tag=!OG,tag=!ALD,tag=CI,tag=!ResetTF,scores={TickFlight=100..,TickFlight=..200}] run tag @s add ResetTF
execute as @p[tag=!CI] run scoreboard players set @s TickFlight 0