Fixed PlayerPickupItem event returning wrong amount picked up and added function to get the amount remaining on the ground.

This commit is contained in:
EvilSeph 2011-07-02 14:04:57 -04:00
parent 180536920c
commit 3f388a2ad9

View File

@ -10,10 +10,12 @@ import org.bukkit.event.Cancellable;
public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
private final Item item;
private boolean cancel = false;
private int remaining;
public PlayerPickupItemEvent(final Player player, final Item item) {
public PlayerPickupItemEvent(final Player player, final Item item, int remaining) {
super(Type.PLAYER_PICKUP_ITEM, player);
this.item = item;
this.remaining = remaining;
}
/**
@ -25,6 +27,15 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
return item;
}
/**
* Gets the amount remaining on the ground, if any
*
* @return amount remaining on the ground
*/
public int getRemaining() {
return remaining;
}
/**
* Gets the cancellation state of this event. A cancelled event will not
* be executed in the server, but will still pass to other plugins