All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bukkit.event.player.PlayerVelocityEvent Maven / Gradle / Ivy

There is a newer version: 2.4.0
Show newest version
package org.bukkit.event.player;

import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.util.Vector;

/**
 * Called when the velocity of a player changes.
 */
public class PlayerVelocityEvent extends PlayerEvent implements Cancellable {
  private static final HandlerList handlers = new HandlerList();
  private boolean cancel = false;
  private Vector velocity;

  public PlayerVelocityEvent(final Player player, final Vector velocity) {
    super(player);
    this.velocity = velocity;
  }

  public static HandlerList getHandlerList() {
    return handlers;
  }

  public boolean isCancelled() {
    return cancel;
  }

  public void setCancelled(boolean cancel) {
    this.cancel = cancel;
  }

  /**
   * Gets the velocity vector that will be sent to the player
   *
   * @return Vector the player will get
   */
  public Vector getVelocity() {
    return velocity;
  }

  /**
   * Sets the velocity vector that will be sent to the player
   *
   * @param velocity The velocity vector that will be sent to the player
   */
  public void setVelocity(Vector velocity) {
    this.velocity = velocity;
  }

  @Override
  public HandlerList getHandlers() {
    return handlers;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy