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

org.bukkit.event.entity.EntityTeleportEvent Maven / Gradle / Ivy

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

import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;

/**
 * Thrown when a non-player entity (such as an Enderman) tries to teleport
 * from one location to another.
 */
public class EntityTeleportEvent extends EntityEvent implements Cancellable {
  private static final HandlerList handlers = new HandlerList();
  private boolean cancel;
  private Location from;
  private Location to;

  public EntityTeleportEvent(Entity what, Location from, Location to) {
    super(what);
    this.from = from;
    this.to = to;
    this.cancel = false;
  }

  public static HandlerList getHandlerList() {
    return handlers;
  }

  public boolean isCancelled() {
    return cancel;
  }

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

  /**
   * Gets the location that this entity moved from
   *
   * @return Location this entity moved from
   */
  public Location getFrom() {
    return from;
  }

  /**
   * Sets the location that this entity moved from
   *
   * @param from New location this entity moved from
   */
  public void setFrom(Location from) {
    this.from = from;
  }

  /**
   * Gets the location that this entity moved to
   *
   * @return Location the entity moved to
   */
  public Location getTo() {
    return to;
  }

  /**
   * Sets the location that this entity moved to
   *
   * @param to New Location this entity moved to
   */
  public void setTo(Location to) {
    this.to = to;
  }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy