diff options
author | Steve Anton <anxuiz.nx@gmail.com> | 2012-08-03 10:07:04 -0700 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2012-08-03 23:44:45 -0500 |
commit | f90bd7e7cc781df97965816f3456874b9d66477b (patch) | |
tree | 413c92cf84c844a017c55d80c8d0e3fb9c448199 /src/main/java | |
parent | 02d6703da779a5876ceaf5d2fd2dd9833a7a6621 (diff) | |
download | craftbukkit-f90bd7e7cc781df97965816f3456874b9d66477b.tar craftbukkit-f90bd7e7cc781df97965816f3456874b9d66477b.tar.gz craftbukkit-f90bd7e7cc781df97965816f3456874b9d66477b.tar.lz craftbukkit-f90bd7e7cc781df97965816f3456874b9d66477b.tar.xz craftbukkit-f90bd7e7cc781df97965816f3456874b9d66477b.zip |
Fix PlayerBucketEmptyEvent handling. Fixes BUKKIT-2002 and fixes BUKKIT-1997
The method this.a(world, d0, d1, d2, i, j, k) is responsible for
actually placing the lava or water source block in the world. The event
is currently called after this method, thus canceling the event will
cause the player to keep their water/lava bucket but the water/lava will
still appear where they attempted to place it.
In addition, the check for whether a player has creative inventory is
short circuiting before the event fires, so the event will not be called
for these players.
This moves the event call and cancelled check above these two calls to
ensure it always fires and the results of it are honored.
Closes GH-835.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/net/minecraft/server/ItemBucket.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java index 4d1e2fcc..bab155b0 100644 --- a/src/main/java/net/minecraft/server/ItemBucket.java +++ b/src/main/java/net/minecraft/server/ItemBucket.java @@ -135,18 +135,16 @@ public class ItemBucket extends Item { return itemstack; } - if (this.a(world, d0, d1, d2, i, j, k) && !entityhuman.abilities.canInstantlyBuild) { - // CraftBukkit start - PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(entityhuman, clickedX, clickedY, clickedZ, movingobjectposition.face, itemstack); + // CraftBukkit start + PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(entityhuman, clickedX, clickedY, clickedZ, movingobjectposition.face, itemstack); - if (event.isCancelled()) { - return itemstack; - } - // CraftBukkit end - // CraftBukkit TODO: look for all the stuff that disappeared here, and make sure this is still where it should be - // CraftBukkit start - return CraftItemStack.createNMSItemStack(event.getItemStack()); - // CraftBukkit end + if (event.isCancelled()) { + return itemstack; + } + // CraftBukkit end + + if (this.a(world, d0, d1, d2, i, j, k) && !entityhuman.abilities.canInstantlyBuild) { + return CraftItemStack.createNMSItemStack(event.getItemStack()); // CraftBukkit } } } else if (this.a == 0 && movingobjectposition.entity instanceof EntityCow) { |