001    package org.bukkit.event.entity;
002    
003    import org.bukkit.entity.Entity;
004    import org.bukkit.entity.Explosive;
005    import org.bukkit.event.Cancellable;
006    import org.bukkit.event.HandlerList;
007    
008    /**
009     * Called when an entity has made a decision to explode.
010     */
011    public class ExplosionPrimeEvent extends EntityEvent implements Cancellable {
012        private static final HandlerList handlers = new HandlerList();
013        private boolean cancel;
014        private float radius;
015        private boolean fire;
016    
017        public ExplosionPrimeEvent(final Entity what, final float radius, final boolean fire) {
018            super(what);
019            this.cancel = false;
020            this.radius = radius;
021            this.fire = fire;
022        }
023    
024        public ExplosionPrimeEvent(final Explosive explosive) {
025            this(explosive, explosive.getYield(), explosive.isIncendiary());
026        }
027    
028        public boolean isCancelled() {
029            return cancel;
030        }
031    
032        public void setCancelled(boolean cancel) {
033            this.cancel = cancel;
034        }
035    
036        /**
037         * Gets the radius of the explosion
038         *
039         * @return returns the radius of the explosion
040         */
041        public float getRadius() {
042            return radius;
043        }
044    
045        /**
046         * Sets the radius of the explosion
047         *
048         * @param radius the radius of the explosion
049         */
050        public void setRadius(float radius) {
051            this.radius = radius;
052        }
053    
054        /**
055         * Gets whether this explosion will create fire or not
056         *
057         * @return true if this explosion will create fire
058         */
059        public boolean getFire() {
060            return fire;
061        }
062    
063        /**
064         * Sets whether this explosion will create fire or not
065         *
066         * @param fire true if you want this explosion to create fire
067         */
068        public void setFire(boolean fire) {
069            this.fire = fire;
070        }
071    
072        @Override
073        public HandlerList getHandlers() {
074            return handlers;
075        }
076    
077        public static HandlerList getHandlerList() {
078            return handlers;
079        }
080    }