Commits
md_5 authored 1b414f02478
1 - | package org.bukkit.event.player; |
1 + | package org.bukkit.event.entity; |
2 2 | |
3 3 | import org.bukkit.entity.Item; |
4 - | import org.bukkit.entity.Player; |
4 + | import org.bukkit.entity.LivingEntity; |
5 5 | import org.bukkit.event.Cancellable; |
6 6 | import org.bukkit.event.HandlerList; |
7 7 | |
8 8 | /** |
9 - | * Thrown when a player picks an item up from the ground |
9 + | * Thrown when a entity picks an item up from the ground |
10 10 | */ |
11 - | public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable { |
11 + | public class EntityPickupItemEvent extends EntityEvent implements Cancellable { |
12 12 | private static final HandlerList handlers = new HandlerList(); |
13 13 | private final Item item; |
14 14 | private boolean cancel = false; |
15 15 | private final int remaining; |
16 16 | |
17 - | public PlayerPickupItemEvent(final Player player, final Item item, final int remaining) { |
18 - | super(player); |
17 + | public EntityPickupItemEvent(final LivingEntity entity, final Item item, final int remaining) { |
18 + | super(entity); |
19 19 | this.item = item; |
20 20 | this.remaining = remaining; |
21 21 | } |
22 22 | |
23 + | |
24 + | public LivingEntity getEntity() { |
25 + | return (LivingEntity) entity; |
26 + | } |
27 + | |
23 28 | /** |
24 - | * Gets the Item picked up by the player. |
29 + | * Gets the Item picked up by the entity. |
25 30 | * |
26 31 | * @return Item |
27 32 | */ |
28 33 | public Item getItem() { |
29 34 | return item; |
30 35 | } |
31 36 | |
32 37 | /** |
33 38 | * Gets the amount remaining on the ground, if any |
34 39 | * |