From b305ed5f0b788d785bfc4725452873b99abb51a3 Mon Sep 17 00:00:00 2001 From: HappyPikachu Date: Wed, 10 Jan 2018 00:35:27 -0500 Subject: [PATCH] Correct itemByStack(), fixes #10 and #36 --- .gitignore | 3 ++- src/main/java/net/milkbowl/vault/item/Items.java | 14 ++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 006f41c..37cc1ae 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /dependency-reduced-pom.xml /.classpath /.project -/.settings \ No newline at end of file +/.settings +/bin/ diff --git a/src/main/java/net/milkbowl/vault/item/Items.java b/src/main/java/net/milkbowl/vault/item/Items.java index 548976d..afb42ac 100644 --- a/src/main/java/net/milkbowl/vault/item/Items.java +++ b/src/main/java/net/milkbowl/vault/item/Items.java @@ -817,10 +817,16 @@ public class Items { } for (ItemInfo item : items) { - if (itemStack.getType().equals(item.getType()) && item.isDurable()) { - return item; - } else if (itemStack.getType().equals(item.getType()) && item.getSubTypeId() == itemStack.getDurability()) { - return item; + if (itemStack.getType().equals(item.getType())) { + if (itemStack.getType().isSolid() && item.getType().isSolid()) { + //Solid, so check durability (Podzol, Colored Wool, et al.) + if (item.isDurable()) { + return item; + } + } else { + //Not solid, so ignore durability (Stick, Stone Button, et al.) + return item; + } } }