All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bukkit.event.entity.EntityDeathEvent Maven / Gradle / Ivy

package org.bukkit.event.entity;

import org.bukkit.entity.LivingEntity;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;

import java.util.List;

/**
 * Thrown whenever a LivingEntity dies
 */
public class EntityDeathEvent extends EntityEvent {
  private static final HandlerList handlers = new HandlerList();
  private final List drops;
  private int dropExp = 0;

  public EntityDeathEvent(final LivingEntity entity, final List drops) {
    this(entity, drops, 0);
  }

  public EntityDeathEvent(final LivingEntity what, final List drops, final int droppedExp) {
    super(what);
    this.drops = drops;
    this.dropExp = droppedExp;
  }

  public static HandlerList getHandlerList() {
    return handlers;
  }

  @Override
  public LivingEntity getEntity() {
    return (LivingEntity) entity;
  }

  /**
   * Gets how much EXP should be dropped from this death.
   * 

* This does not indicate how much EXP should be taken from the entity in * question, merely how much should be created after its death. * * @return Amount of EXP to drop. */ public int getDroppedExp() { return dropExp; } /** * Sets how much EXP should be dropped from this death. *

* This does not indicate how much EXP should be taken from the entity in * question, merely how much should be created after its death. * * @param exp Amount of EXP to drop. */ public void setDroppedExp(int exp) { this.dropExp = exp; } /** * Gets all the items which will drop when the entity dies * * @return Items to drop when the entity dies */ public List getDrops() { return drops; } @Override public HandlerList getHandlers() { return handlers; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy