blob: ab9e81fd260bafa97fdf133c4345e2fe2ff328b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
package org.bukkit.event.entity;
import java.util.List;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
/**
* Thrown whenever a LivingEntity dies
*/
public class EntityDeathEvent extends EntityEvent {
private static final HandlerList handlers = new HandlerList();
private final List<ItemStack> drops;
private int dropExp = 0;
public EntityDeathEvent(final LivingEntity entity, final List<ItemStack> drops) {
this(entity, drops, 0);
}
public EntityDeathEvent(final LivingEntity what, final List<ItemStack> drops, final int droppedExp) {
super(what);
this.drops = drops;
this.dropExp = droppedExp;
}
@Override
public LivingEntity getEntity() {
return (LivingEntity) entity;
}
/**
* Gets how much EXP should be dropped from this death.
* <p>
* 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.
* <p>
* 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<ItemStack> getDrops() {
return drops;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}
|