From f7aeeabe9c2f2a16bd16bc2194ead5e37ec12131 Mon Sep 17 00:00:00 2001 From: themode Date: Sun, 7 Feb 2021 19:38:14 +0100 Subject: [PATCH] Override ItemStack#equals --- src/main/java/net/minestom/server/item/ItemStack.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/net/minestom/server/item/ItemStack.java b/src/main/java/net/minestom/server/item/ItemStack.java index 0e176eedf..1250bdf0c 100644 --- a/src/main/java/net/minestom/server/item/ItemStack.java +++ b/src/main/java/net/minestom/server/item/ItemStack.java @@ -189,6 +189,12 @@ public class ItemStack implements DataContainer, PublicCloneable { } } + @Override + public boolean equals(Object o) { + return o instanceof ItemStack && + isSimilar((ItemStack) o) && ((ItemStack) o).getAmount() == getAmount(); + } + /** * Gets the item damage (durability). *