diff options
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r-- | src/main/java/net/minecraft/server/PlayerConnection.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java index 13c27051..00c68615 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -760,6 +760,10 @@ public class PlayerConnection extends Connection { if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex < PlayerInventory.getHotbarSize()) { PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex); this.server.getPluginManager().callEvent(event); + if (event.isCancelled()) { + this.sendPacket(new Packet16BlockItemSwitch(this.player.inventory.itemInHandIndex)); + return; + } // CraftBukkit end this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex; |