mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 08:17:44 +01:00
Use Item from PlayerPickupItemEvent when fired (fixes #1717)
This commit is contained in:
parent
bb7d367269
commit
9a85c96402
@ -7,7 +7,7 @@ Mojang was sleeping even if we had no more requests to go after
|
|||||||
the current one finished, resulting in 100ms lost per profile lookup
|
the current one finished, resulting in 100ms lost per profile lookup
|
||||||
|
|
||||||
diff --git a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
|
diff --git a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
|
||||||
index 26a743722..6ed3199c3 100644
|
index 71e48e87b..23f1447cf 100644
|
||||||
--- a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
|
--- a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
|
||||||
+++ b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
|
+++ b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
|
||||||
@@ -0,0 +0,0 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository {
|
@@ -0,0 +0,0 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository {
|
||||||
|
@ -5,17 +5,20 @@ Subject: [PATCH] Fix #1420
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||||
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
index 66e574bd3..a72d3dcc6 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||||
if (!this.world.isClientSide && (this.inGround || this.q()) && this.shake <= 0) {
|
if (!this.world.isClientSide && (this.inGround || this.q()) && this.shake <= 0) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
ItemStack itemstack = this.getItemStack();
|
ItemStack itemstack = this.getItemStack();
|
||||||
|
- EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
|
||||||
|
+ EntityItem item = null; // Paper - GH-1420 - allow using event item
|
||||||
+ if (!itemstack.isEmpty()) { // Paper - GH-1420 (skip pick up event for fully damaged (or air) itemstack)
|
+ if (!itemstack.isEmpty()) { // Paper - GH-1420 (skip pick up event for fully damaged (or air) itemstack)
|
||||||
EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
|
+ item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack); // Paper - GH-1420 - allow using event item
|
||||||
if (this.fromPlayer == PickupStatus.ALLOWED && entityhuman.inventory.canHold(itemstack) > 0) {
|
if (this.fromPlayer == PickupStatus.ALLOWED && entityhuman.inventory.canHold(itemstack) > 0) {
|
||||||
PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), (org.bukkit.entity.Arrow) this.getBukkitEntity());
|
PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), (org.bukkit.entity.Arrow) this.getBukkitEntity());
|
||||||
|
// event.setCancelled(!entityhuman.canPickUpLoot); TODO
|
||||||
@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -24,7 +27,7 @@ index 7ac07ac07ac0..7ac07ac07ac0 100644
|
|||||||
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild || this.q() && this.getShooter().getUniqueID() == entityhuman.getUniqueID();
|
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild || this.q() && this.getShooter().getUniqueID() == entityhuman.getUniqueID();
|
||||||
|
|
||||||
- if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(item.getItemStack())) {
|
- if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(item.getItemStack())) {
|
||||||
+ if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(itemstack)) { // Paper - GH-1420
|
+ if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(item != null ? item.getItemStack() : itemstack)) { // Paper - GH-1420
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user