Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SuppressWarnings("deprecation")
- public static boolean isSimilar(ItemStack a, ItemStack b) {
- if(a == null || b == null)
- return false;
- if(a.getType() != b.getType())
- return false;
- if (Bukkit.getVersion().contains("1.8") ||
- Bukkit.getVersion().contains("1.9") ||
- Bukkit.getVersion().contains("1.10")||
- Bukkit.getVersion().contains("1.11")||
- Bukkit.getVersion().contains("1.12")) {
- System.out.println(a.getData().getData() + ":" + b.getData().getData());
- if (a.getData().getData() != b.getData().getData())
- return false;
- }
- if(a.hasItemMeta() != b.hasItemMeta())
- return false;
- ItemMeta first = a.getItemMeta();
- ItemMeta second = b.getItemMeta();
- if (first.hasDisplayName() != second.hasDisplayName())
- return false;
- if (first.hasDisplayName() && second.hasDisplayName()) {
- if (!first.getDisplayName().equals(second.getDisplayName()))
- return false;
- }
- if (first.hasLore() && second.hasLore()) {
- if (!first.getLore().equals(second.getLore()))
- return false;
- }
- if (!first.getEnchants().equals(second.getEnchants()))
- return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement