001    package org.bukkit.event.vehicle;
002    
003    import org.bukkit.entity.Entity;
004    import org.bukkit.entity.Vehicle;
005    import org.bukkit.event.Cancellable;
006    import org.bukkit.event.HandlerList;
007    
008    /**
009     * Raised when a vehicle is destroyed, which could be caused by either a
010     * player or the environment. This is not raised if the boat is simply
011     * 'removed' due to other means.
012     */
013    public class VehicleDestroyEvent extends VehicleEvent implements Cancellable {
014        private static final HandlerList handlers = new HandlerList();
015        private final Entity attacker;
016        private boolean cancelled;
017    
018        public VehicleDestroyEvent(final Vehicle vehicle, final Entity attacker) {
019            super(vehicle);
020            this.attacker = attacker;
021        }
022    
023        /**
024         * Gets the Entity that has destroyed the vehicle, potentially null
025         *
026         * @return the Entity that has destroyed the vehicle, potentially null
027         */
028        public Entity getAttacker() {
029            return attacker;
030        }
031    
032        public boolean isCancelled() {
033            return cancelled;
034        }
035    
036        public void setCancelled(boolean cancel) {
037            this.cancelled = cancel;
038        }
039    
040        @Override
041        public HandlerList getHandlers() {
042            return handlers;
043        }
044    
045        public static HandlerList getHandlerList() {
046            return handlers;
047        }
048    }