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
@ -10,10 +10,12 @@ import org.bukkit.event.Cancellable;
|
|||||||
public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
||||||
private final Item item;
|
private final Item item;
|
||||||
private boolean cancel = false;
|
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);
|
super(Type.PLAYER_PICKUP_ITEM, player);
|
||||||
this.item = item;
|
this.item = item;
|
||||||
|
this.remaining = remaining;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,6 +27,15 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
|||||||
return item;
|
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
|
* Gets the cancellation state of this event. A cancelled event will not
|
||||||
* be executed in the server, but will still pass to other plugins
|
* be executed in the server, but will still pass to other plugins
|
||||||
|
Loading…
x
Reference in New Issue
Block a user