mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-21 05:44:17 +00:00
Fixed PlayerPickupItem event returning wrong amount picked up and added function to get the amount remaining on the ground.
This commit is contained in:
parent
180536920c
commit
3f388a2ad9
1 changed files with 12 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue