Jump to content

Inventory contains all items


harrypotter

Recommended Posts

1 minute ago, Stimpack said:

I believe he's asking for a method for checking if the inventory contains all items, and possibly any others. This methods checks if the inventory contains all the items and no others.

Link to comment
Share on other sites

On 3/30/2017 at 10:09 AM, Polymorphism said:

You could do something like


String[] ITEMS = ....

for(String item : ITEMS)

   if(!inventory.contains(item))

        return false



return true;

 

No need for external object to store data simply call as the following instead, you also can call Strings instead as well rather than pull the ids.

if (getInventory().contains(1042, 1050, 11694)) {
 // do stuff
}

 

Link to comment
Share on other sites

14 hours ago, Booleans YAY said:

No need for external object to store data simply call as the following instead, you also can call Strings instead as well rather than pull the ids.


if (getInventory().contains(1042, 1050, 11694)) {
 // do stuff
}

 

Read the OP, this is not the same behaviour as the code the post you quoted contains. And the OP literally said the method you posted doesn't do what he needs.

Edited by Reveance
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...