Im trying to do a command project, and I am trying to detect if someone presses space while mid air. Does anyone know how to do this with commands? Thanks.

  • 2
    Does it have to be space? Or can it for example also be Q? I'm pretty sure that the only way to even have the action of pressig space sent to the server is with elytra, but that would jitter and move the player a bit forward, even if you remove the elytra immediately. Sep 24, 2017 at 22:54
  • You should probably take a look at the Minecraft scoreboard objective stat.jump which seems to be made exactly for that purpose. Sep 25, 2017 at 10:26
  • @JulianLachniet Does that actually work, did you try it? Dec 12, 2017 at 16:36

2 Answers 2


I'm pretty sure that's not possible, but you could maybe try to test if they are shifting? I am not sure how but I do know there is a scoreboard objective for that, you could probably look it up. Another option is to give them an item in which when dropped, the player receives the action by using testfor and execute commands. If you're curious how, look it up because I can't get to my world in which I did this kind of thing, but I got it so you can too.

  • You got down votes because your answer doesn't answer the question. 'Pretty sure' is not good enough for an answer. If you don't have the time/want to test your idea, put it in the comments like Fabian did. Also, you suggest two sort of alternatives that are maybe possible which you don't explain very well and suggest the OP looks it up. 'Look it up' is also not an answer. Arqade is supposed to be where you come to ask a question after you have already looked it up and can not find an answer.
    – IronAnvil
    Sep 25, 2017 at 17:23

The best approximation of this that you could do would be detecting when a player starts flying with elytra. For this, you need to store the entries in the "Motion" NBT tag to scoreboards and compare them to the values of the last tick. This is nothing exact, because players can move while falling without elytra and can change direction quickly with elytra to not gain much speed, but it might work in some cases.

What does not work: minecraft.custom:minecraft.jump only tracks actual jumps, minecraft.used:minecraft.elytra does not seem to trigger ever.

What I recommend instead: There are lots of things that are much easier to detect, for example dropping an item (minecraft.dropped:minecraft.<id> together with the presence of an item entity with custom data nearby), activating an item (like an unbreakable carrot-on-a-stick), selecting a slot (NBT tag SelectedItemSlot) or pretty much everything that has a statistic.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .