I'm working on a map that requires a command to run if a player is using an gliding with an elytra. Are there any NBT tags or other commands that can be used to testfor gliding?


The FallFlying tag will be 1 if the player (or any other mob) is flying with elytra. You can apply a label to the player based on that value for multiplayer-friendly detection:

/scoreboard players tag @a[tag=flying] remove flying
/scoreboard players tag @a add flying {FallFlying:1b}

/say Players that are flying: @a[tag=flying]
| improve this answer | |

Firstly, you can find out if the player ever flyed with the Elytra with this:

/scoreboard objectives add Flying stat.aviateOneCm

But that's not all. You can add a independent Repeat and Always Active command block to /testfor if all players that have flyed are not on the ground:

/execute @a[score_Flying_min=1] ~ ~ ~ /testforblock ~ ~-1 ~ air

Then, to find out if this command returns false, use /testforblock again (X, Y and Z are the coordinates of the command block above) and put it in a Repeat and Always Active command block:

/testforblock X Y Z command_block -1 {SuccessCount:0}

Next to this one, place a Chain command block with a command to reset the scoreboard objective for all players:

/scoreboard players set @a Flying 0

Note: The above contraption is basically an implication gate - the output is activated only when input (command) 1 is activated, and command 2 not. You can replace command block #3 with an redstone implication gate. Now, you've set up a elytra-flight detector (not compatible for multiplayer). To execute a command when a player is flying, use /execute:

/execute @a[score_Flying_min=1] ~ ~ ~ <command>


/execute @a[score_Flying_min=1] ~ ~ ~ say hello

Helpful links:

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.