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:
parent
f82f291deb
commit
ccbd9a6709
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user