Advertisement
danik159

Untitled

Aug 14th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. @SuppressWarnings("deprecation")
  2. public static boolean isSimilar(ItemStack a, ItemStack b) {
  3. if(a == null || b == null)
  4. return false;
  5.  
  6. if(a.getType() != b.getType())
  7. return false;
  8.  
  9. if (Bukkit.getVersion().contains("1.8") ||
  10. Bukkit.getVersion().contains("1.9") ||
  11. Bukkit.getVersion().contains("1.10")||
  12. Bukkit.getVersion().contains("1.11")||
  13. Bukkit.getVersion().contains("1.12")) {
  14. System.out.println(a.getData().getData() + ":" + b.getData().getData());
  15. if (a.getData().getData() != b.getData().getData())
  16. return false;
  17.  
  18. }
  19.  
  20. if(a.hasItemMeta() != b.hasItemMeta())
  21. return false;
  22.  
  23. ItemMeta first = a.getItemMeta();
  24. ItemMeta second = b.getItemMeta();
  25.  
  26.  
  27. if (first.hasDisplayName() != second.hasDisplayName())
  28. return false;
  29.  
  30. if (first.hasDisplayName() && second.hasDisplayName()) {
  31. if (!first.getDisplayName().equals(second.getDisplayName()))
  32. return false;
  33. }
  34.  
  35.  
  36. if (first.hasLore() && second.hasLore()) {
  37. if (!first.getLore().equals(second.getLore()))
  38. return false;
  39. }
  40.  
  41. if (!first.getEnchants().equals(second.getEnchants()))
  42. return false;
  43.  
  44. return true;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement