diff options
author | BlackyPaw <kapilands@web.de> | 2015-06-21 12:28:37 +0200 |
---|---|---|
committer | md_5 <git@md-5.net> | 2015-09-30 08:48:28 +1000 |
commit | 8cc1683e83cf62458971ef6c56cb5d32a5dc780b (patch) | |
tree | 0be7f81b977798d62dc68e794df7ab58adc1e863 /src/main/java/org | |
parent | 62a216966f980addcd14deb1a9ed0ab146fd3ddf (diff) | |
download | craftbukkit-8cc1683e83cf62458971ef6c56cb5d32a5dc780b.tar craftbukkit-8cc1683e83cf62458971ef6c56cb5d32a5dc780b.tar.gz craftbukkit-8cc1683e83cf62458971ef6c56cb5d32a5dc780b.tar.lz craftbukkit-8cc1683e83cf62458971ef6c56cb5d32a5dc780b.tar.xz craftbukkit-8cc1683e83cf62458971ef6c56cb5d32a5dc780b.zip |
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.
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java index 02b32cfa..a17a537d 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 |