public void onPlayerMove(PlayerMoveEvent event) {
// Get the player's information
String playerName = event.getPlayer().getName();
double x = event.getTo().getX();
double y = event.getTo().getY();
double z = event.getTo().getZ();
Vector velocity = event.getPlayer().getVelocity();
// Calculate speed
double speed = velocity.length();
// Calculate friction (negative acceleration)
double friction = -0.98 * speed;
// Calculate jump height (vertical movement)
double jumpHeight = Math.abs(event.getFrom().getY() - event.getTo().getY());
// Calculate horizontal speed
double horizontalSpeed = Math.sqrt(velocity.getX() * velocity.getX() + velocity.getZ() * velocity.getZ());
// Calculate pitch (looking up or down)
float pitch = event.getPlayer().getLocation().getPitch();
// Calculate yaw (looking left or right)
float yaw = event.getPlayer().getLocation().getYaw();
// Calculate acceleration (change in velocity per tick)
Vector prevVelocity = event.getPlayer().getVelocity();
Vector acceleration = velocity.clone().subtract(prevVelocity);
// Calculate vertical acceleration
double verticalAcceleration = acceleration.getY();
// Calculate horizontal acceleration
double horizontalAcceleration = Math.sqrt(acceleration.getX() * acceleration.getX() + acceleration.getZ() * acceleration.getZ());
// Log the player's movement variables
getLogger().info(playerName + " moved to X:" + x + " Y:" + y + " Z:" + z);
getLogger().info(playerName + " velocity X:" + velocity.getX() + " Y:" + velocity.getY() + " Z:" + velocity.getZ());
getLogger().info(playerName + " speed: " + speed);
getLogger().info(playerName + " friction: " + friction);
getLogger().info(playerName + " jump height: " + jumpHeight);
getLogger().info(playerName + " horizontal speed: " + horizontalSpeed);
getLogger().info(playerName + " pitch: " + pitch);
getLogger().info(playerName + " yaw: " + yaw);
getLogger().info(playerName + " vertical acceleration: " + verticalAcceleration);
getLogger().info(playerName + " horizontal acceleration: " + horizontalAcceleration);
}
}