Advertisement
Guest User

Untitled

a guest
Apr 16th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. private boolean inventoryContainsItem(Inventory inventory, ItemStack compareItem) {
  2. int id = compareItem.getTypeId();
  3. short data = compareItem.getDurability();
  4. String name = compareItem.getItemMeta().getDisplayName();
  5. List<String> lore = compareItem.getItemMeta().getLore();
  6. for (ItemStack item : inventory.getContents()) {
  7. if (item != null) {
  8.  
  9. if (item.hasItemMeta()) {
  10.  
  11. Bukkit.broadcastMessage(item.getItemMeta().getDisplayName());
  12. Bukkit.broadcastMessage(name);
  13. Bukkit.broadcastMessage(item.getItemMeta().getLore().toString());
  14. Bukkit.broadcastMessage(lore.toString());
  15. if (item.getTypeId() == id && item.getDurability() == data && item.getItemMeta().getDisplayName().toString() == name && item.getItemMeta().getLore() == lore) {
  16. Bukkit.broadcastMessage("removing item");
  17. inventory.remove(item);
  18. return true;
  19. } else {
  20. return false;
  21. }
  22. }
  23. else {
  24. return false;
  25. }
  26. }
  27. else {
  28. return false;
  29. }
  30. }
  31.  
  32. return true;
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement