@Override
public void setVelocity(Vector velocity) {
super.setVelocity(velocity);
if (isSpoutCraftEnabled()) {
PlayerVelocityEvent event = new PlayerVelocityEvent(this, velocity);
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
sendPacket(new PacketSetVelocity(getEntityId(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ()));
}
double speedX = Math.abs(event.getVelocity().getX() * event.getVelocity().getX());
double speedY = Math.abs(event.getVelocity().getY() * event.getVelocity().getY());
double speedZ = Math.abs(event.getVelocity().getZ() * event.getVelocity().getZ());
double speed = speedX + speedY + speedZ;
velocityAdjustmentTime = System.currentTimeMillis() + (long) (speed * 5);
getHandle().velocityChanged = false; // Prevents nms from sending an override packet later, but still tells the server about the new velocity
}