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 ~-2~1~2 ~-2~2~2 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~-2~1~2 ~-2~2~2 ~~~ masked if blocks ~-2~2~2 ~-2~3~2 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~-2~1~2 ~-2~2~2 ~~~ masked if blocks ~-2~2~2 ~-2~3~2 ~~~ masked if blocks ~-2~3~2 ~-2~4~2 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~-2~1~2 ~-2~2~2 ~~~ masked if blocks ~-2~2~2 ~-2~3~2 ~~~ masked if blocks ~-2~3~2 ~-2~4~2 ~~~ masked if blocks ~-2~4~2 ~-2~5~2 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~-2~5~2 ~-2~20~2 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~2~1~-2 ~2~2~-2 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~2~1~-2 ~2~2~-2 ~~~ masked if blocks ~2~2~-2 ~2~3~-2 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~2~1~-2 ~2~2~-2 ~~~ masked if blocks ~2~2~-2 ~2~3~-2 ~~~ masked if blocks ~2~3~-2 ~2~4~-2 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~2~1~-2 ~2~2~-2 ~~~ masked if blocks ~2~2~-2 ~2~3~-2 ~~~ masked if blocks ~2~3~-2 ~2~4~-2 ~~~ masked if blocks ~2~4~-2 ~2~5~-2 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s if blocks ~2~5~-2 ~2~20~-2 ~~~ masked run tag @s remove SH
execute as @p[tag=NP] at @s unless blocks ~-2~1~2 ~-2~2~2 ~~~ masked unless blocks ~-2~2~2 ~-2~3~2 ~~~ masked unless blocks ~-2~3~2 ~-2~4~2 ~~~ masked unless blocks ~-2~4~2 ~-2~5~2 ~~~ masked unless blocks ~-2~5~2 ~-2~20~2 ~~~ masked unless blocks ~2~1~-2 ~2~2~-2 ~~~ masked unless blocks ~2~2~-2 ~2~3~-2 ~~~ masked unless blocks ~2~3~-2 ~2~4~-2 ~~~ masked unless blocks ~2~4~-2 ~2~5~-2 ~~~ masked unless blocks ~2~5~-2 ~2~20~-2 ~~~ masked run tag @s add SH
execute as @p[tag=NP,tag=SH] at @s anchored feet if blocks ~~~-1 ~~~-64 ~~~ masked run tag @s remove SP
execute as @p[tag=NP,tag=SH] at @s anchored feet if blocks ~~~1 ~~~64 ~~~ masked run tag @s remove SP
execute as @p[tag=NP,tag=SH] at @s anchored feet if blocks ~-1~~ ~-64~~ ~~~ masked run tag @s remove SP
execute as @p[tag=NP,tag=SH] at @s anchored feet if blocks ~1~~ ~64~~ ~~~ masked run tag @s remove SP
execute as @p[tag=NP,tag=SH] at @s anchored feet unless blocks ~~~-1 ~~~-64 ~~~ masked unless blocks ~~~1 ~~~64 ~~~ masked unless blocks ~-1~~ ~-64~~ ~~~ masked unless blocks ~1~~ ~64~~ ~~~ 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=PLC] run tag @s remove BO
execute as @p[tag=PLCS] run tag @s remove BO
execute as @p[tag=PDC] run tag @s remove BO
execute as @p[tag=PDCS] run tag @s remove BO
execute as @p[tag=PLS,m=survival] run tag @s add PLPS
execute as @p[tag=PLS,m=adventure] run tag @s add PLPS
execute as @p[tag=PLS,tag=!SM,tag=!AM] run tag @s remove PLPS
execute as @p[tag=PLC,m=creative] run tag @s add PLPC
execute as @p[tag=PLC,m=!creative] run tag @s remove PLPC
execute as @p[tag=!PLS] run tag @s remove PLPS
execute as @p[tag=!PLC] run tag @s remove PLPC
execute as @p[tag=PLSS,m=survival] run tag @s add PLPSS
execute as @p[tag=PLSS,m=adventure] run tag @s add PLPSS
execute as @p[tag=PLSS,tag=!SM,tag=!AM] run tag @s remove PLPSS
execute as @p[tag=PLCS,m=creative] run tag @s add PLPCS
execute as @p[tag=PLCS,m=!creative] run tag @s remove PLPCS
execute as @p[tag=!PLSS] run tag @s remove PLPSS
execute as @p[tag=!PLCS] run tag @s remove PLPCS
execute as @p[tag=PDS,m=survival] run tag @s add PDPS
execute as @p[tag=PDS,m=adventure] run tag @s add PDPS
execute as @p[tag=PDS,tag=!SM,tag=!AM] run tag @s remove PDPS
execute as @p[tag=PDC,m=creative] run tag @s add PDPC
execute as @p[tag=PDC,m=!creative] run tag @s remove PDPC
execute as @p[tag=!PDS] run tag @s remove PDPS
execute as @p[tag=!PDC] run tag @s remove PDPC
execute as @p[tag=PDSS,m=survival] run tag @s add PDPSS
execute as @p[tag=PDSS,m=adventure] run tag @s add PDPSS
execute as @p[tag=PDSS,tag=!SM,tag=!AM] run tag @s remove PDPSS
execute as @p[tag=PDCS,m=creative] run tag @s add PDPCS
execute as @p[tag=PDCS,m=!creative] run tag @s remove PDPCS
execute as @p[tag=!PDSS] run tag @s remove PDPSS
execute as @p[tag=!PDCS] run tag @s remove PDPCS
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