Resolved Inventory.containsAllOf(Filter<SpriteItem>) is broken

Discussion in 'Client & Site Support' started by Aidden, Aug 5, 2014.

  1. Seems to always return true.
    Code (Text):
    2.     Filter<SpriteItem> axeFilter = new Filter<SpriteItem>() {
    4.         @Override
    5.         public boolean accepts(SpriteItem item) {
    6.             // TODO Auto-generated method stub
    7.             return item != null && item.getDefinition() != null && item.getDefinition().getName().toLowerCase().contains("axe") && !item.getDefinition().getName().toLowerCase().contains("broken");
    8.         }
    10.     };
    No matter what i change the name to, containsAllOf(filter) returns true.
  2. Try (just a suggestion):

    Suggestion 1:


    Suggestion 2:
    Do a System.out.println(); on every single of the 4 conditions in your return statement and check which one is returning true when it shouldn't(play a bit with it to find out the wrong one).
  3. The thing is, when i change it to Inventory.containsAnyOf(filter) using the same filter, it works correctly. So i'm assuming it's not a problem with the filter.
  4. I see.. as a temporary workaround use multiple containsAnyOf() ?
    Cloud will probably be able to fix this :p
  5. Only need one, and i am :) It's just to see if we have a usable axe, if we don't then the script bot stops.
  6. The naming for this particular overload may be bad. Whereas the containsAllOf(String/int) verify that each individual element is in there, containsAllOf(Filter) does a check to verify that all of the items in the inventory match the given filter.
    Exile likes this.
  7. Ahh yes that destinction should probably be made in the docs or something lol
  8. Agreed @Cloud.
  9. It was renamed as soon as it got brought up.
    Exile likes this.

Share This Page