From f442a92c1ede92943c80baf4b265c612113279b3 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sun, 15 Jan 2012 09:52:56 +0000 Subject: ItemStack.getMaxStackSize no longer incorrectly returns -1 when not backed by an NMS instance. Thanks to feildmaster for the PR. This fixes BUKKIT-530 --- src/main/java/org/bukkit/inventory/ItemStack.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/main/java/org') 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; } -- cgit v1.2.3