001 package org.bukkit.event.entity;
002
003 import org.bukkit.entity.Entity;
004 import org.bukkit.event.Cancellable;
005 import org.bukkit.event.HandlerList;
006
007 /**
008 * Called when an entity combusts.
009 * <p>
010 * If an Entity Combust event is cancelled, the entity will not combust.
011 */
012 public class EntityCombustEvent extends EntityEvent implements Cancellable {
013 private static final HandlerList handlers = new HandlerList();
014 private int duration;
015 private boolean cancel;
016
017 public EntityCombustEvent(final Entity combustee, final int duration) {
018 super(combustee);
019 this.duration = duration;
020 this.cancel = false;
021 }
022
023 public boolean isCancelled() {
024 return cancel;
025 }
026
027 public void setCancelled(boolean cancel) {
028 this.cancel = cancel;
029 }
030
031 /**
032 * @return the amount of time (in seconds) the combustee should be alight
033 * for
034 */
035 public int getDuration() {
036 return duration;
037 }
038
039 /**
040 * The number of seconds the combustee should be alight for.
041 * <p>
042 * This value will only ever increase the combustion time, not decrease
043 * existing combustion times.
044 *
045 * @param duration the time in seconds to be alight for.
046 */
047 public void setDuration(int duration) {
048 this.duration = duration;
049 }
050
051 @Override
052 public HandlerList getHandlers() {
053 return handlers;
054 }
055
056 public static HandlerList getHandlerList() {
057 return handlers;
058 }
059 }