- Joined
- Dec 10, 2014
- Messages
- 3,255
- Thread Author
- #1
Found a weird issue where my Inventory.contains(Pattern) was returning false for a certain item. It's worked fine for everything else and this is the first time I've encountered this behavior.
Code:
Output:
Inventory.contains(pattern) is simply !Inventory.newQuery().names(pattern).results().isEmpty();
If I use getPatternForContainsString(name) it returns true though.
@Cloud
Code:
Code:
this.name = name;
this.pattern = Regex.getPatternForExactString(name);
if(Inventory.contains(name)){
System.out.println("Contains name:"+name);
if(Inventory.contains(pattern)){
System.out.println("Contains pattern:"+pattern);
} else {
System.out.println("Doesn't contain pattern:" + pattern);
}
} else {
System.out.println("Doesn't contain name:"+name);
}
Code:
(07:47:18) Contains name:Weapon poison++ (unf)
(07:47:18) Doesn't contain pattern:^Weapon poison++ \(unf\)$
Inventory.contains(pattern) is simply !Inventory.newQuery().names(pattern).results().isEmpty();
If I use getPatternForContainsString(name) it returns true though.
@Cloud