Paper/Spigot-Server-Patches/0150-Fix-AIOOBE-in-inventory-handling.patch
Aikar 094bb03a37
Optimize Hoppers
- Lots of itemstack cloning removed. Only clone if the item is actually moved
- Return true when a plugin cancels inventory move item event instead of false, as false causes pulls to cycle through all items.
  However, pushes do not exhibit the same behavior, so this is not something plugins could of been relying on.
- Add option (Default on) to cooldown hoppers when they fail to move an item due to full inventory
- Skip subsequent InventoryMoveItemEvents if a plugin does not use the item after first event fire for an iteration
2018-02-12 23:26:02 -05:00

23 lines
1.1 KiB
Diff

From 89ff4cf85bdfee0627ec4a7d5261b83e6984e385 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Sun, 4 Sep 2016 16:35:43 -0500
Subject: [PATCH] Fix AIOOBE in inventory handling
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 98cb84409..5e0e5a3c1 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1849,7 +1849,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
case CLONE:
if (packetplayinwindowclick.c() == 2) {
click = ClickType.MIDDLE;
- if (packetplayinwindowclick.b() == -999) {
+ if (packetplayinwindowclick.b() < 0) { // Paper - GH-404
action = InventoryAction.NOTHING;
} else {
Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.b());
--
2.16.1