From 8cc1683e83cf62458971ef6c56cb5d32a5dc780b Mon Sep 17 00:00:00 2001 From: BlackyPaw Date: Sun, 21 Jun 2015 12:28:37 +0200 Subject: [PATCH] SPIGOT-989: Cap assignment of pickup delays to Short.MAX_VALUE due to storage implementation constraints. Changed assignment of pickup delays in such a way that they may not be larger than the value actually stored inside the NBT format that is Short.MAX_VALUE. Did not change method signature in order not to produce any shortening cast warnings in existing code. All values larger than 32767 are generally used to indicate that an item should never be picked up. Shortening this to 32767 will actually cause the pickup delay to never decrease, thus resulting in non-pickupable item stacks. --- src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java index 02b32cfa63..a17a537d69 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java @@ -34,7 +34,7 @@ public class CraftItem extends CraftEntity implements Item { } public void setPickupDelay(int delay) { - item.pickupDelay = delay; + item.pickupDelay = Math.min(delay, Short.MAX_VALUE); } @Override