summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Broes <erikbroes@grum.nl>2011-06-26 17:02:47 +0200
committerErik Broes <erikbroes@grum.nl>2011-06-27 00:05:17 +0200
commit9e5dba8306f77e0583537efe7d5b3670639e3382 (patch)
tree8411f58dade3f176007279cdbc99823ecc8b7766
parentf0402d9d6c683a95f40ebb4e7634e3d814bbdf21 (diff)
downloadcraftbukkit-9e5dba8306f77e0583537efe7d5b3670639e3382.tar
craftbukkit-9e5dba8306f77e0583537efe7d5b3670639e3382.tar.gz
craftbukkit-9e5dba8306f77e0583537efe7d5b3670639e3382.tar.lz
craftbukkit-9e5dba8306f77e0583537efe7d5b3670639e3382.tar.xz
craftbukkit-9e5dba8306f77e0583537efe7d5b3670639e3382.zip
Picking up arrows now also fires PlayerPickupItem
-rw-r--r--src/main/java/net/minecraft/server/EntityArrow.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index b3417858..df6878f2 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -9,6 +9,7 @@ import org.bukkit.entity.Projectile;
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+import org.bukkit.event.player.PlayerPickupItemEvent;
// CraftBukkit end
public class EntityArrow extends Entity {
@@ -290,6 +291,20 @@ public class EntityArrow extends Entity {
public void b(EntityHuman entityhuman) {
if (!this.world.isStatic) {
+ // CraftBukkit start
+ ItemStack itemstack = new ItemStack(Item.ARROW, 1);
+ if (this.i && this.a && this.b <= 0 && entityhuman.inventory.canPickup(itemstack) > 0) {
+ net.minecraft.server.EntityItem item = new net.minecraft.server.EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
+
+ PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), item));
+ this.world.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
+ }
+ }
+ // CraftBukkt end
+
if (this.i && this.a && this.b <= 0 && entityhuman.inventory.canHold(new ItemStack(Item.ARROW, 1))) {
this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.receive(this, 1);