diff options
author | EvilSeph <evilseph@unaligned.org> | 2011-05-09 15:53:53 -0400 |
---|---|---|
committer | EvilSeph <evilseph@unaligned.org> | 2011-05-09 15:53:53 -0400 |
commit | 5ca0a881ad9817a929745e6701a53437db0ad2c9 (patch) | |
tree | 123dc3bb095b2985d26093188346c12d812ed510 /src/main/java | |
parent | 0faaf5af8a5c8b1c804ee8f6f07afedd88814aeb (diff) | |
download | craftbukkit-5ca0a881ad9817a929745e6701a53437db0ad2c9.tar craftbukkit-5ca0a881ad9817a929745e6701a53437db0ad2c9.tar.gz craftbukkit-5ca0a881ad9817a929745e6701a53437db0ad2c9.tar.lz craftbukkit-5ca0a881ad9817a929745e6701a53437db0ad2c9.tar.xz craftbukkit-5ca0a881ad9817a929745e6701a53437db0ad2c9.zip |
Moved inventory cleaning to occur after the event is called to preserve the exact state of the inventory for plugin use.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityPlayer.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index e04fa6e1..53bc19be 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -102,14 +102,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { for (int i = 0; i < inventory.items.length; ++i) { if (inventory.items[i] != null) { loot.add(new CraftItemStack(inventory.items[i])); - inventory.items[i] = null; } } for (int i = 0; i < inventory.armor.length; ++i) { if (inventory.armor[i] != null) { loot.add(new CraftItemStack(inventory.armor[i])); - inventory.armor[i] = null; } } @@ -120,6 +118,15 @@ public class EntityPlayer extends EntityHuman implements ICrafting { EntityDeathEvent event = new EntityDeathEvent(craftEntity, loot); server.getPluginManager().callEvent(event); + // CraftBukkit - we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. + for (int i = 0; i < inventory.items.length; ++i) { + inventory.items[i] = null; + } + + for (int i = 0; i < inventory.armor.length; ++i) { + inventory.armor[i] = null; + } + for (org.bukkit.inventory.ItemStack stack: event.getDrops()) { cworld.dropItemNaturally(craftEntity.getLocation(), stack); } @@ -132,7 +139,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { if (this.bG > 0) { return false; } else { - if (!this.world.pvpMode) { // CraftBukkit this.b.pvpMode -> this.world.pvpMode + if (!this.world.pvpMode) { // CraftBukkit this.b.pvpMode -> this.world.pvpMode if (entity instanceof EntityHuman) { return false; } |