From 4c9bf34bf3f7954313dd6e5f8d8b208119c115ca Mon Sep 17 00:00:00 2001 From: bloodshot Date: Mon, 6 Jan 2014 18:02:01 -0500 Subject: [PATCH] Update client stack when block place is cancelled. Fixes BUKKIT-5284 Currently, whenever a player places a block in a protected area the equipped itemstack size on client is never updated properly since the client thinks the block was placed. The reason this happens is because ItemStack.matches returns true since the server does not decrement stack size if a BlockPlaceEvent is cancelled. To correct this on cancel we set the flag to always update the client regardless of matching. --- src/main/java/net/minecraft/server/PlayerConnection.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java index 9fa307ef59..75a5cbe261 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -626,7 +626,9 @@ public class PlayerConnection implements PacketPlayInListener { return; } - this.player.playerInteractManager.interact(this.player, worldserver, itemstack, i, j, k, l, packetplayinblockplace.h(), packetplayinblockplace.i(), packetplayinblockplace.j()); + if (!this.player.playerInteractManager.interact(this.player, worldserver, itemstack, i, j, k, l, packetplayinblockplace.h(), packetplayinblockplace.i(), packetplayinblockplace.j())) { + always = true; // force PacketPlayOutSetSlot to be sent to client to update ItemStack count + } // CraftBukkit end flag = true;