mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-13 11:18:23 +01:00
Fixed PlayerPickupItem event firing even if the player could not pick up the item.
This commit is contained in:
parent
98098481e9
commit
ebfd973d09
1 changed files with 3 additions and 3 deletions
|
@ -127,12 +127,12 @@ public class EntityItem extends Entity {
|
|||
int i = this.itemStack.count;
|
||||
|
||||
// CraftBukkit start
|
||||
if (this.pickupDelay <= 0) { // <-- == to <=
|
||||
if (this.pickupDelay <= 0 && entityhuman.inventory.canHold(this.itemStack)) { // <-- == to <=
|
||||
Player player = (Player) entityhuman.getBukkitEntity();
|
||||
PlayerPickupItemEvent event = new PlayerPickupItemEvent(player, (org.bukkit.entity.Item) this.getBukkitEntity());
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled() || !entityhuman.inventory.canHold(this.itemStack)) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
|
Loading…
Add table
Reference in a new issue