Skip to content

Commit

Permalink
Fix inventory.contains.display for books
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 24, 2015
1 parent 42246f8 commit 025493c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/main/java/net/aufdemrand/denizen/objects/dInventory.java
Expand Up @@ -1155,15 +1155,26 @@ public String getAttribute(Attribute attribute) {

if (strict) {
for (ItemStack item : getContents()) {
if (item != null && item.hasItemMeta() && item.getItemMeta().hasDisplayName() &&
if (item != null && item.getType() == Material.WRITTEN_BOOK
&& ((BookMeta)item.getItemMeta()).getTitle().equalsIgnoreCase(search_string)) {
found_items += item.getAmount();
if (found_items >= qty) break;
}
else if (item != null && item.hasItemMeta() && item.getItemMeta().hasDisplayName() &&
item.getItemMeta().getDisplayName().equalsIgnoreCase(search_string)) {
found_items += item.getAmount();
if (found_items >= qty) break;
}
}
} else {
for (ItemStack item : getContents()) {
if (item != null && item.hasItemMeta() && item.getItemMeta().hasDisplayName() &&
if (item != null && item.getType() == Material.WRITTEN_BOOK
&& ((BookMeta)item.getItemMeta()).getTitle()
.toLowerCase().contains(search_string.toLowerCase())) {
found_items += item.getAmount();
if (found_items >= qty) break;
}
else if (item != null && item.hasItemMeta() && item.getItemMeta().hasDisplayName() &&
item.getItemMeta().getDisplayName().toLowerCase()
.contains(search_string.toLowerCase())) {
found_items += item.getAmount();
Expand Down

0 comments on commit 025493c

Please sign in to comment.