diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-01-27 13:25:20 +0000 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-01-27 13:25:20 +0000 |
commit | 6c4698c313991c134ed80661e40750b837ec4b8d (patch) | |
tree | 319078570b434e2993ee203855312ff88b5b89c2 /src | |
parent | b2efe281229378967d9c0633b82f0303b7b621f4 (diff) | |
download | bukkit-6c4698c313991c134ed80661e40750b837ec4b8d.tar bukkit-6c4698c313991c134ed80661e40750b837ec4b8d.tar.gz bukkit-6c4698c313991c134ed80661e40750b837ec4b8d.tar.lz bukkit-6c4698c313991c134ed80661e40750b837ec4b8d.tar.xz bukkit-6c4698c313991c134ed80661e40750b837ec4b8d.zip |
ENTITY_DEATH
Diffstat (limited to 'src')
3 files changed, 41 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java new file mode 100644 index 00000000..a18d93e5 --- /dev/null +++ b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java @@ -0,0 +1,36 @@ + +package org.bukkit.event.entity; + +import java.util.List; +import org.bukkit.entity.Entity; +import org.bukkit.inventory.ItemStack; + +/** + * Thrown whenever a LivingEntity dies + */ +public class EntityDeathEvent extends EntityEvent { + private List<ItemStack> drops; + + public EntityDeathEvent(final Type type, final Entity what, final List<ItemStack> drops) { + super(type, what); + this.drops = drops; + } + + /** + * Sets what items will be dropped when this entity dies + * + * @param drops Items to drop when the entity dies + */ + public void setDrops(final List<ItemStack> drops) { + this.drops = drops; + } + + /** + * Gets all the items which will drop when the entity dies + * + * @return Items to drop when the entity dies + */ + public List<ItemStack> getDrops() { + return drops; + } +} diff --git a/src/main/java/org/bukkit/event/entity/EntityListener.java b/src/main/java/org/bukkit/event/entity/EntityListener.java index 10ceda1f..41ecad9a 100644 --- a/src/main/java/org/bukkit/event/entity/EntityListener.java +++ b/src/main/java/org/bukkit/event/entity/EntityListener.java @@ -29,4 +29,7 @@ public class EntityListener implements Listener { public void onEntityTarget(EntityTargetEvent event) { } + + public void onEntityDeath(EntityDeathEvent event) { + } } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index f0844258..7f8594cd 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.EntityDeathEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityListener; import org.bukkit.event.entity.EntityTargetEvent; @@ -234,7 +235,7 @@ public final class JavaPluginLoader implements PluginLoader { trueListener.onEntityDamage((EntityDamageEvent)event); break; case ENTITY_DEATH: - // TODO: ENTITY_DEATH hook + trueListener.onEntityDeath((EntityDeathEvent)event); break; case ENTITY_COMBUST: trueListener.onEntityCombust((EntityCombustEvent)event); |