distraction 61 Share Posted August 7, 2017 I recently noticed that "getBank().count(string)" will return "1" for some (maybe all?) items with placeholders, even if there aren't actually any of that item left in the bank. I ended up coming across this while debugging to figure out why "getBank().contains(string)" was returning true when there wasn't any of the item left in the bank. I checked what "getBank().count(string)" returned if there actually was one of the item in the bank, and that also returns "1". I also checked what it returns if there are more than one of the item in the bank, and that seemed to work as expected. Releasing the placeholder seems to fix the issue, so the issue (if it is in fact a bug) seems to be to do with placeholders. Is this a bug? If not, what would be the proper way to check if there are none of the item left in the bank with placeholders on? For now I have resorted to checking if the amount left is 1 or less. The items that I confirmed this happening for were "Flax", and "Iron ore". It may happen for other/all items, but I only tested for those two. Link to comment Share on other sites More sharing options...
Roma 2221 Share Posted August 8, 2017 I recently noticed that "getBank().count(string)" will return "1" for some (maybe all?) items with placeholders, even if there aren't actually any of that item left in the bank. I ended up coming across this while debugging to figure out why "getBank().contains(string)" was returning true when there wasn't any of the item left in the bank. I checked what "getBank().count(string)" returned if there actually was one of the item in the bank, and that also returns "1". I also checked what it returns if there are more than one of the item in the bank, and that seemed to work as expected. Releasing the placeholder seems to fix the issue, so the issue (if it is in fact a bug) seems to be to do with placeholders. Is this a bug? If not, what would be the proper way to check if there are none of the item left in the bank with placeholders on? For now I have resorted to checking if the amount left is 1 or less. The items that I confirmed this happening for were "Flax", and "Iron ore". It may happen for other/all items, but I only test for those two. You can use widgets to check if it's a placeholder, maybe there's a better solution idk. Link to comment Share on other sites More sharing options...
Nuclear Nezz 2040 Share Posted August 8, 2017 It's because the placeholder is still an item in the bank. If you want it to not include placeholders, then you can do count(i->i != null && i.getName().equals("name"); && !i.isPlaceholder()) or something along those line. Link to comment Share on other sites More sharing options...
distraction 61 Author Share Posted August 8, 2017 It's because the placeholder is still an item in the bank. If you want it to not include placeholders, then you can do count(i->i != null && i.getName().equals("name"); && !i.isPlaceholder()) or something along those line. That makes sense, thank you for the help. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.