summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorNathan Adams <dinnerbone@dinnerbone.com>2012-01-15 09:52:56 +0000
committerNathan Adams <dinnerbone@dinnerbone.com>2012-01-15 10:00:27 +0000
commitf442a92c1ede92943c80baf4b265c612113279b3 (patch)
tree1e6477ded157cd6faffbc321b3578f196b5a1373 /src/main
parent039ec8a56342a359790d96a395b74663dce61487 (diff)
downloadbukkit-f442a92c1ede92943c80baf4b265c612113279b3.tar
bukkit-f442a92c1ede92943c80baf4b265c612113279b3.tar.gz
bukkit-f442a92c1ede92943c80baf4b265c612113279b3.tar.lz
bukkit-f442a92c1ede92943c80baf4b265c612113279b3.tar.xz
bukkit-f442a92c1ede92943c80baf4b265c612113279b3.zip
ItemStack.getMaxStackSize no longer incorrectly returns -1 when not backed by an NMS instance. Thanks to feildmaster for the PR. This fixes BUKKIT-530
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/bukkit/inventory/ItemStack.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index d8256fca..c856b3ae 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -174,6 +174,11 @@ public class ItemStack implements ConfigurationSerializable {
* @return The maximum you can stack this material to.
*/
public int getMaxStackSize() {
+ Material material = getType();
+ if (material != null) {
+ return material.getMaxStackSize();
+ }
+
return -1;
}