ENTITY_DEATH

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot 2011-01-27 13:25:20 +00:00
parent a079602347
commit b26b68a61a
3 changed files with 41 additions and 1 deletions

View file

@ -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;
}
}

View file

@ -29,4 +29,7 @@ public class EntityListener implements Listener {
public void onEntityTarget(EntityTargetEvent event) { public void onEntityTarget(EntityTargetEvent event) {
} }
public void onEntityDeath(EntityDeathEvent event) {
}
} }

View file

@ -21,6 +21,7 @@ import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityListener; import org.bukkit.event.entity.EntityListener;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
@ -234,7 +235,7 @@ public final class JavaPluginLoader implements PluginLoader {
trueListener.onEntityDamage((EntityDamageEvent)event); trueListener.onEntityDamage((EntityDamageEvent)event);
break; break;
case ENTITY_DEATH: case ENTITY_DEATH:
// TODO: ENTITY_DEATH hook trueListener.onEntityDeath((EntityDeathEvent)event);
break; break;
case ENTITY_COMBUST: case ENTITY_COMBUST:
trueListener.onEntityCombust((EntityCombustEvent)event); trueListener.onEntityCombust((EntityCombustEvent)event);