1
0
mirror of https://github.com/PaperMC/Paper.git synced 2025-03-02 11:22:01 +01:00

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

By: EvilSeph <evilseph@unaligned.org>
This commit is contained in:
Bukkit/Spigot 2011-07-02 14:04:57 -04:00
parent f82f291deb
commit ccbd9a6709

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