Advertisement
Guest User

Comparator Usage - Comparing items with metadata

a guest
Apr 26th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.53 KB | None | 0 0
  1. public static boolean compare(ItemStack original, ItemStack compare)
  2.     {
  3.         if(Comparator.compare(original.getType(), compare.getType())) //Compare materials
  4.         {
  5.             if(Comparator.compare(original.getData().getData(), compare.getData().getData())) //Compare metadata ID
  6.             {
  7.                 if(Comparator.compare(hasMeta(original), hasMeta(compare))) //Make sure they both DO or DO NOT have meta.
  8.                 {
  9.                     if(hasMeta(original))
  10.                     {
  11.                         if(Comparator.compare(getName(original), getName(compare)))
  12.                         {
  13.                             if(Comparator.compare(hasLore(original), hasLore(compare)))
  14.                             {
  15.                                 if(hasLore(original))
  16.                                 {
  17.                                     List<String> oLore = getLore(original);
  18.                                     List<String> cLore = getLore(compare);
  19.                                    
  20.                                     return cLore.equals(oLore);
  21.                                 }
  22.                                 else
  23.                                 {
  24.                                     return true;
  25.                                 }
  26.                             }
  27.                         }
  28.                     }
  29.                     else
  30.                     {
  31.                         return true;
  32.                     }
  33.                 }
  34.             }
  35.         }
  36.        
  37.         return false;
  38.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement