From a76a5bd36f052470d2f4112f7de9286dabbc2f12 Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Sat, 16 Mar 2013 10:27:46 -0500 Subject: [PATCH] Ignore invalid inventory slots. Fixes BUKKIT-3737 --- src/main/java/net/minecraft/server/PlayerConnection.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java index aeca924f2b..10fedeb4d0 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -1159,6 +1159,11 @@ public class PlayerConnection extends Connection { if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) { // CraftBukkit start - fire InventoryClickEvent + if (packet102windowclick.slot == -1) { + // Vanilla doesn't do anything with this, neither should we + return; + } + InventoryView inventory = this.player.activeContainer.getBukkitView(); SlotType type = CraftInventoryView.getSlotType(inventory, packet102windowclick.slot); @@ -1223,8 +1228,9 @@ public class PlayerConnection extends Connection { this.player.a(this.player.activeContainer, arraylist); // CraftBukkit start - send a Set Slot to update the crafting result slot - if(type == SlotType.RESULT && itemstack != null) + if(type == SlotType.RESULT && itemstack != null) { this.player.playerConnection.sendPacket((Packet) (new Packet103SetSlot(this.player.activeContainer.windowId, 0, itemstack))); + } // CraftBukkit end } }