mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 10:17:38 +01:00
SPIGOT-2242: Handle changed item in PlayerPickupArrowEvent
By: md_5 <git@md-5.net>
This commit is contained in:
parent
87d502339e
commit
25e61b60e4
@ -46,15 +46,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (entity.damageEntity(damagesource, (float) i)) {
|
if (entity.damageEntity(damagesource, (float) i)) {
|
||||||
@@ -422,6 +436,20 @@
|
@@ -422,9 +436,22 @@
|
||||||
|
|
||||||
public void d(EntityHuman entityhuman) {
|
public void d(EntityHuman entityhuman) {
|
||||||
if (!this.world.isClientSide && this.inGround && this.shake <= 0) {
|
if (!this.world.isClientSide && this.inGround && this.shake <= 0) {
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ ItemStack itemstack = new ItemStack(Items.ARROW);
|
+ ItemStack itemstack = this.j(); // PAIL: rename
|
||||||
|
+ EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
|
||||||
+ if (this.fromPlayer == PickupStatus.ALLOWED && entityhuman.inventory.canHold(itemstack) > 0) {
|
+ if (this.fromPlayer == PickupStatus.ALLOWED && entityhuman.inventory.canHold(itemstack) > 0) {
|
||||||
+ EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
|
|
||||||
+
|
|
||||||
+ 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
|
+ // event.setCancelled(!entityhuman.canPickUpLoot); TODO
|
||||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||||
@ -63,11 +62,15 @@
|
|||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
|
||||||
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild;
|
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild;
|
||||||
|
|
||||||
if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(this.j())) {
|
- if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(this.j())) {
|
||||||
@@ -493,7 +521,14 @@
|
+ if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(item.getItemStack())) {
|
||||||
|
+ // CraftBukkit end
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -493,7 +520,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EnchantmentManager.a(Enchantments.ARROW_FIRE, entityliving) > 0) {
|
if (EnchantmentManager.a(Enchantments.ARROW_FIRE, entityliving) > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user