Detecting a jump on Minecraft server with Bukkit or Spigot

Jeremy Karlsson
1 min readDec 19, 2016

--

The Spigot/Bukkit API does not expose an event to which you can react to jumps. When creating my MushPoof plugin for Minecraft, I needed a way to detect it.

After some investigation, I noticed that when a user is not jumping, the Y value of the velocity object is constant at -0.0784000015258789.

So I’ve set this as a variable in my file;

final double STILL = -0.0784000015258789;

Then, we need to listen to the PlayerMoveEvent. And in this, we check that the Y value of the velocity of the player is bigger than the STILL variable defined above;

@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
boolean isJumping = player.getVelocity().getY() > STILL;
}

--

--