Skip to content

Commit 3f70985

Browse files
committed
Fix Bukkit Item Matcher
1 parent de99612 commit 3f70985

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

src/main/java/org/maxgamer/quickshop/util/matcher/item/BukkitItemMatcherImpl.java

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import org.maxgamer.quickshop.QuickShop;
2828
import org.maxgamer.quickshop.api.shop.ItemMatcher;
2929

30-
import java.util.Objects;
31-
3230
/**
3331
* A simple impl for ItemMatcher
3432
*
@@ -68,21 +66,12 @@ public class BukkitItemMatcherImpl implements ItemMatcher {
6866
*/
6967
@Override
7068
public boolean matches(@Nullable ItemStack original, @Nullable ItemStack tester) {
71-
return Objects.equals(original, tester);
72-
/*
73-
@Override
74-
@Utility
75-
public boolean equals(Object obj) {
76-
if (this == obj) {
77-
return true;
78-
}
79-
if (!(obj instanceof ItemStack)) {
80-
return false;
81-
}
82-
83-
ItemStack stack = (ItemStack) obj;
84-
return getAmount() == stack.getAmount() && isSimilar(stack);
69+
if (original == null && tester == null) {
70+
return true;
71+
}
72+
if ((original == null) != (tester == null)) {
73+
return false;
8574
}
86-
*/
75+
return tester.isSimilar(original);
8776
}
8877
}

src/main/resources/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ matcher:
480480
#1= Bukkit item matcher, can be more accurate.
481481
#2= Stricter Bukkit matcher, equals method.
482482
work-type: 0
483-
#For Item
483+
#For Item (Only works under QuickShop ItemMatcher)
484484
item:
485485
#Should the Plugin check the item damage?
486486
damage: true

0 commit comments

Comments
 (0)