How to test for a player boosting with a firework while flying with elytra

Solution 1:

You can do this with just two command blocks:

  1. Make a scoreboard objective with type "dummy" (referred to as [objective]
  2. Make a repeating command block leading into a chain command block (both always active)
  3. Set repeating command block's command to scoreboard players set @a [objective] 0
  4. Set chain command block's command to execute @e[type=fireworks_rocket] ~ ~ ~ scoreboard players set @p[r=1] [objective] 1

This works because when you use a firework while gliding, the fireworks entity still exists and is constantly teleported to the player that used it. The first command reset's all players scores, and the second one sets any players who are rocket gliding score to 1, allowing you to execute commands on anyone who is rocket gliding.

Note: If a player lands while their firework is still active, they are technically still rocket gliding until the rocket runs out. Also, the fireworks will also set players score when placed immediately next to a player.