Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public int addItem(Item newItem){
  2. int itemExists = indexOf(newItem.getName());
  3. if (itemExists == -1){
  4. return -1;
  5.  
  6. }
  7. // int i = itemList.length;
  8. // increaseArray();
  9. if (newItem == null){
  10.  
  11. return -1;
  12. }
  13. if (newItem.getDurability() < 1){
  14. return -1;
  15.  
  16. }
  17. //
  18. // for (int f = 0; f < i; f++){
  19. // if (newItem == itemList[f]){
  20. // return -1;
  21. // }
  22. // }
  23. //
  24. // itemList[i] = newItem;
  25. // return i;
  26. increaseArray();
  27. itemList[itemList.length] = newItem;
  28. return i;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement