diff options
author | speakeasy <mekevin1917@gmail.com> | 2011-01-17 22:27:48 +0800 |
---|---|---|
committer | Dinner Bone <dinnerbone@dinnerbone.com> | 2011-01-18 00:22:02 +0800 |
commit | f4908db7c14eb9537b3bf2adc12175d39c776079 (patch) | |
tree | 6b51cac32e35c1dca82cf45f4ccbb1e0e518478b /src | |
parent | 06d99445d9f696710be92f3eaa56f866c728e5ea (diff) | |
download | bukkit-f4908db7c14eb9537b3bf2adc12175d39c776079.tar bukkit-f4908db7c14eb9537b3bf2adc12175d39c776079.tar.gz bukkit-f4908db7c14eb9537b3bf2adc12175d39c776079.tar.lz bukkit-f4908db7c14eb9537b3bf2adc12175d39c776079.tar.xz bukkit-f4908db7c14eb9537b3bf2adc12175d39c776079.zip |
Added EntityExplodeEvent :D
Diffstat (limited to 'src')
4 files changed, 53 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java index a7399da7..548ef0f0 100644 --- a/src/main/java/org/bukkit/event/Event.java +++ b/src/main/java/org/bukkit/event/Event.java @@ -445,6 +445,13 @@ public abstract class Event { * @todo: add javadoc see comment */ ENTITY_COMBUST (Category.LIVING_ENTITY), + + /** + * Called when an entity explodes, either TNT, Creeper, or Ghast Fireball + * + * @todo: add javadoc see comment + */ + ENTITY_EXPLODE (Category.LIVING_ENTITY), /** * VEHICLE EVENTS diff --git a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java new file mode 100644 index 00000000..ea17975d --- /dev/null +++ b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java @@ -0,0 +1,39 @@ + +package org.bukkit.event.entity; + +import java.util.List; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.event.Cancellable; + +/** + * + * @author SpeaKeasY + */ +public class EntityExplodeEvent extends EntityEvent implements Cancellable { + private boolean cancel; + private List blocks; + + public EntityExplodeEvent (Type type, Entity what, List<Block> blocks) { + super(type.ENTITY_EXPLODE, what); + this.cancel = false; + this.blocks = blocks; + } + + public boolean isCancelled() { + return cancel; + } + + public void setCancelled(boolean cancel) { + this.cancel = cancel; + } + + /** + * Returns the list of blocks that would have been removed or were + * removed from the explosion event. + */ + public List<Block> blockList() { + return blocks; + } + +} diff --git a/src/main/java/org/bukkit/event/entity/EntityListener.java b/src/main/java/org/bukkit/event/entity/EntityListener.java index 03bc5ba0..143beb05 100644 --- a/src/main/java/org/bukkit/event/entity/EntityListener.java +++ b/src/main/java/org/bukkit/event/entity/EntityListener.java @@ -23,4 +23,7 @@ public class EntityListener implements Listener { public void onEntityDamage(EntityDamageEvent event) { } + + public void onEntityExplode(EntityExplodeEvent event) { + } } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index 6ade2579..bff47558 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -21,6 +21,7 @@ import org.bukkit.event.entity.EntityDamageByBlockEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityListener; import org.bukkit.event.player.*; import org.bukkit.event.server.PluginEvent; @@ -228,6 +229,9 @@ public final class JavaPluginLoader implements PluginLoader { case ENTITY_COMBUST: trueListener.onEntityCombust((EntityCombustEvent)event); break; + case ENTITY_EXPLODE: + trueListener.onEntityExplode((EntityExplodeEvent)event); + break; } } else if (listener instanceof VehicleListener) { VehicleListener trueListener = (VehicleListener)listener; |