use of org.bukkit.enchantments.Enchantment in project MyPet by xXKeyleXx.
the class ItemStackComparator method compareEnchantments.
public static boolean compareEnchantments(ItemStack i1, ItemStack i2) {
if (i1 == null || i2 == null) {
return false;
}
if (i1.getEnchantments().size() == i2.getEnchantments().size()) {
Map<Enchantment, Integer> e1 = i1.getEnchantments();
Map<Enchantment, Integer> e2 = i2.getEnchantments();
Enchantment[] e1l = new Enchantment[e1.size()];
int i = 0;
for (Enchantment enchantment : e1.keySet()) {
e1l[i++] = enchantment;
}
i = 0;
for (Enchantment enchantment : e2.keySet()) {
if (e1l[i].getId() != enchantment.getId()) {
// MyPetLogger.write("enchantment: " + e1l[i].getId() + "<->" + enchantment.getId());
return false;
} else if (!e1.get(e1l[i]).equals(e2.get(enchantment))) {
// MyPetLogger.write("level: " + e1.get(e1l[i]) + "<->" + e2.get(enchantment));
return false;
}
i++;
}
return true;
}
// MyPetLogger.write("size: " + i1.getEnchantments().size() + "<->" + i2.getEnchantments().size());
return false;
}
use of org.bukkit.enchantments.Enchantment in project MyPet by xXKeyleXx.
the class ItemStackComparator method compareEnchantments.
public static boolean compareEnchantments(ItemStack i1, ItemStack i2) {
if (i1 == null || i2 == null) {
return false;
}
if (i1.getEnchantments().size() == i2.getEnchantments().size()) {
Map<Enchantment, Integer> e1 = i1.getEnchantments();
Map<Enchantment, Integer> e2 = i2.getEnchantments();
Enchantment[] e1l = new Enchantment[e1.size()];
int i = 0;
for (Enchantment enchantment : e1.keySet()) {
e1l[i++] = enchantment;
}
i = 0;
for (Enchantment enchantment : e2.keySet()) {
if (e1l[i].getId() != enchantment.getId()) {
// MyPetLogger.write("enchantment: " + e1l[i].getId() + "<->" + enchantment.getId());
return false;
} else if (!e1.get(e1l[i]).equals(e2.get(enchantment))) {
// MyPetLogger.write("level: " + e1.get(e1l[i]) + "<->" + e2.get(enchantment));
return false;
}
i++;
}
return true;
}
// MyPetLogger.write("size: " + i1.getEnchantments().size() + "<->" + i2.getEnchantments().size());
return false;
}
use of org.bukkit.enchantments.Enchantment in project MyPet by xXKeyleXx.
the class ItemStackComparator method compareEnchantments.
public static boolean compareEnchantments(ItemStack i1, ItemStack i2) {
if (i1 == null || i2 == null) {
return false;
}
if (i1.getEnchantments().size() == i2.getEnchantments().size()) {
Map<Enchantment, Integer> e1 = i1.getEnchantments();
Map<Enchantment, Integer> e2 = i2.getEnchantments();
Enchantment[] e1l = new Enchantment[e1.size()];
int i = 0;
for (Enchantment enchantment : e1.keySet()) {
e1l[i++] = enchantment;
}
i = 0;
for (Enchantment enchantment : e2.keySet()) {
if (e1l[i].getId() != enchantment.getId()) {
// MyPetLogger.write("enchantment: " + e1l[i].getId() + "<->" + enchantment.getId());
return false;
} else if (!e1.get(e1l[i]).equals(e2.get(enchantment))) {
// MyPetLogger.write("level: " + e1.get(e1l[i]) + "<->" + e2.get(enchantment));
return false;
}
i++;
}
return true;
}
// MyPetLogger.write("size: " + i1.getEnchantments().size() + "<->" + i2.getEnchantments().size());
return false;
}
Aggregations