Guest User

Untitled

a guest
Sep 22nd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. I have created a script that needed only open inventory to run properly. Inventory was used to eat/drink/check things. Now i am adding a logout method or class and i have a serious issue. Its not only when i am creating a logout method/class. Same goes for opening other tabs.
  2.  
  3. When script opens other tab, it wants to open inventory back as soon as possible - without any reason. My script does not contain any inventory opening lines. I do not have anything like Tabs.INVENTORY.open().
  4.  
  5. However i think i do know why its happening.It opens inventory because apparently inventory.getcount() requires it.
  6. Someone told me that i could filter items and then it will work. This is what i have but doesnt work:
  7.  
  8. public static int Inventory(final int id) {
  9. return Inventory.getItems(true,
  10. new Filter<Item>() {
  11. public boolean accept(Item item) {
  12. return item.getId() == id;
  13. }
  14. }).length;
  15. }
  16.  
  17. public static int Inventory(int[] ids) {
  18. final List<int[]> idList = Arrays.asList(ids);
  19. return Inventory.getItems(true,
  20. new Filter<Item>() {
  21. public boolean accept(Item item) {
  22. return idList.contains(item.getId());
  23. }
  24. }).length;
  25. }
Add Comment
Please, Sign In to add comment