diff options
author | Taylor Kelly <tkelly910@gmail.com> | 2011-01-10 06:51:10 +0800 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-01-10 02:59:30 +0000 |
commit | 219c0772fd48e9facb0d2f8cde5920d88bfd0ce6 (patch) | |
tree | c51f328f0cc09e3c4a67258ddb8f1803cd6bde81 | |
parent | 7d6400eb1df06de2f8e341d3b45d1312908f7b15 (diff) | |
download | bukkit-219c0772fd48e9facb0d2f8cde5920d88bfd0ce6.tar bukkit-219c0772fd48e9facb0d2f8cde5920d88bfd0ce6.tar.gz bukkit-219c0772fd48e9facb0d2f8cde5920d88bfd0ce6.tar.lz bukkit-219c0772fd48e9facb0d2f8cde5920d88bfd0ce6.tar.xz bukkit-219c0772fd48e9facb0d2f8cde5920d88bfd0ce6.zip |
EntityCombustEvent
4 files changed, 41 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java index 9524bd71..61bebb4e 100644 --- a/src/main/java/org/bukkit/event/Event.java +++ b/src/main/java/org/bukkit/event/Event.java @@ -423,6 +423,13 @@ public abstract class Event { * @todo: add javadoc see comment */ ENTITY_DEATH (Category.LIVING_ENTITY), + + /** + * Called when a Skeleton or Zombie catch fire due to the sun + * + * @todo: add javadoc see comment + */ + ENTITY_COMBUST (Category.LIVING_ENTITY), /** * VEHICLE EVENTS diff --git a/src/main/java/org/bukkit/event/entity/EntityCombustEvent.java b/src/main/java/org/bukkit/event/entity/EntityCombustEvent.java new file mode 100644 index 00000000..e1e54217 --- /dev/null +++ b/src/main/java/org/bukkit/event/entity/EntityCombustEvent.java @@ -0,0 +1,27 @@ +package org.bukkit.event.entity; + +import org.bukkit.Entity; +import org.bukkit.event.Cancellable; + +/** + * The event when a skeleton or zombie catch on fire due to the sun. + * If the event is cancelled, the fire is stopped. + */ +public class EntityCombustEvent extends EntityEvent implements Cancellable { + private boolean cancel; + + public EntityCombustEvent(Type type, Entity what) { + super(type, what); + this.cancel = false; + } + + @Override + public boolean isCancelled() { + return cancel; + } + + @Override + public void setCancelled(boolean cancel) { + this.cancel = cancel; + } +} diff --git a/src/main/java/org/bukkit/event/entity/EntityListener.java b/src/main/java/org/bukkit/event/entity/EntityListener.java index 60808f52..f7e4de5c 100644 --- a/src/main/java/org/bukkit/event/entity/EntityListener.java +++ b/src/main/java/org/bukkit/event/entity/EntityListener.java @@ -14,4 +14,7 @@ public class EntityListener implements Listener { public void onEntityDamagedByEntity(EntityDamagedByEntityEvent event) { } + + public void onEntityCombust(EntityCombustEvent event) { + } } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index 346429d5..75d4d91c 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -16,6 +16,7 @@ import org.bukkit.event.CustomEventListener; import org.bukkit.event.Event; import org.bukkit.event.Listener; import org.bukkit.event.block.*; +import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamagedByBlockEvent; import org.bukkit.event.entity.EntityDamagedByEntityEvent; import org.bukkit.event.entity.EntityListener; @@ -179,6 +180,9 @@ public final class JavaPluginLoader implements PluginLoader { case ENTITY_DEATH: // TODO: ENTITY_DEATH hook break; + case ENTITY_COMBUST: + trueListener.onEntityCombust((EntityCombustEvent)event); + break; } } else if (listener instanceof VehicleListener) { VehicleListener trueListener = (VehicleListener)listener; |