From b26b68a61a31d30dd486fa996a3fc427b4480e58 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Thu, 27 Jan 2011 13:25:20 +0000 Subject: [PATCH] ENTITY_DEATH By: Dinnerbone --- .../bukkit/event/entity/EntityDeathEvent.java | 36 +++++++++++++++++++ .../bukkit/event/entity/EntityListener.java | 3 ++ .../bukkit/plugin/java/JavaPluginLoader.java | 3 +- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 paper-api/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java new file mode 100644 index 0000000000..a18d93e5ae --- /dev/null +++ b/paper-api/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 drops; + + public EntityDeathEvent(final Type type, final Entity what, final List 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 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 getDrops() { + return drops; + } +} diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityListener.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityListener.java index 10ceda1f4f..41ecad9af4 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityListener.java +++ b/paper-api/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/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index f084425839..7f8594cd99 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/paper-api/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);