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

org.bukkit.event.vehicle.VehicleDestroyEvent Maven / Gradle / Ivy

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

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

/**
 * Raised when a vehicle is destroyed, which could be caused by either a
 * player or the environment. This is not raised if the boat is simply
 * 'removed' due to other means.
 */
public class VehicleDestroyEvent extends VehicleEvent implements Cancellable {
  private static final HandlerList handlers = new HandlerList();
  private final Entity attacker;
  private boolean cancelled;

  public VehicleDestroyEvent(final Vehicle vehicle, final Entity attacker) {
    super(vehicle);
    this.attacker = attacker;
  }

  public static HandlerList getHandlerList() {
    return handlers;
  }

  /**
   * Gets the Entity that has destroyed the vehicle, potentially null
   *
   * @return the Entity that has destroyed the vehicle, potentially null
   */
  public Entity getAttacker() {
    return attacker;
  }

  public boolean isCancelled() {
    return cancelled;
  }

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy