Fix ItemMatcher bugs.

Former-commit-id: 2418c4bd624f19745fb79df926a1c8974e28476a [formerly d9c0aed489021dad7d8e5683894bd58bb2934347]
Former-commit-id: 93107c54fecb77bc8b3cdff9f3da04cbfa056b04
This commit is contained in:
Ghost_chu committed 2019-08-19 15:00:54 +08:00
1 parent 227d1c0382
commit b349d9ce02
2 files changed
+14 -3

No files matched your search

@@ -69,6 +69,7 @@ public class PermissionManager {
if(Util.isDevMode()){
try{
PermissionInfomationContainer container = provider.getDebugInfo(sender, permission);
Util.debugLog("Result: "+result);
Util.debugLog("Sender: "+container.getSender().getName());
Util.debugLog("Permission Node: "+container.getPermission());
Util.debugLog("Primary Group: "+container.getGroupName());
@@ -15,6 +15,8 @@ import org.bukkit.potion.PotionData;
import org.jetbrains.annotations.*;
import org.maxgamer.quickshop.QuickShop;
import javax.rmi.CORBA.UtilDelegate;
/**
* A util allow quickshop check item matches easy and quick.
*/
@@ -42,22 +44,30 @@ public class ItemMatcher {
}
if (requireStack == null || givenStack == null) {
Util.debugLog("Match failed: A stack is null: " + "requireStack["+String.valueOf(requireStack)+"] givenStack["+givenStack+"]");
return false; // One of them is null (Can't be both, see above)
}
if (plugin.getConfig().getBoolean("shop.strict-matches-check")) {
Util.debugLog("Execute strict match check...");
return requireStack.equals(givenStack);
}
if (!typeMatches(requireStack, givenStack)) {
Util.debugLog("Type not match.");
return false;
}
if (requireStack.hasItemMeta() != givenStack.hasItemMeta()) {
return false;
}
// if (requireStack.hasItemMeta() != givenStack.hasItemMeta()) {
// Util.debugLog("Meta not matched");
// return false;
// }
if (requireStack.hasItemMeta()) {
if(!givenStack.hasItemMeta()){
Util.debugLog("Meta not match.");
return false;
}
return itemMetaMatcher.matches(requireStack, givenStack);
}