1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 11:45:51 +00:00

Make requested changes. Use Object.equals() instead of !=, make docs overall better

This commit is contained in:
ProfElements 2021-02-27 18:23:28 -06:00
parent fb86415f31
commit 9e01444b69

View File

@ -54,7 +54,7 @@ public class BookBinder extends AContainer {
Map<Enchantment, Integer> storedTargetEnchantments = targetMeta.getStoredEnchants(); Map<Enchantment, Integer> storedTargetEnchantments = targetMeta.getStoredEnchants();
Map<Enchantment, Integer> enchantments = combineEnchantments(storedItemEnchantments, storedTargetEnchantments); Map<Enchantment, Integer> enchantments = combineEnchantments(storedItemEnchantments, storedTargetEnchantments);
//just return if enchantments are none. shouldnt ever happen. :NotLikeThis: // Just return if no enchantments exist. This shouldn't ever happen. :NotLikeThis:
if (enchantments.size() > 0) { if (enchantments.size() > 0) {
ItemStack book = new ItemStack(Material.ENCHANTED_BOOK); ItemStack book = new ItemStack(Material.ENCHANTED_BOOK);
@ -64,7 +64,7 @@ public class BookBinder extends AContainer {
enchantMeta.addStoredEnchant(entry.getKey(), entry.getValue(), bypassVanillaMaxLevel.getValue()); enchantMeta.addStoredEnchant(entry.getKey(), entry.getValue(), bypassVanillaMaxLevel.getValue());
} }
//Make sure we never return a no enchant enchanted book. // Make sure we never return an enchanted book with no enchantments.
if (enchantMeta.getStoredEnchants().isEmpty()) { if (enchantMeta.getStoredEnchants().isEmpty()) {
return null; return null;
} }
@ -116,8 +116,8 @@ public class BookBinder extends AContainer {
for (Map.Entry<Enchantment, Integer> entry : ech2.entrySet()) { for (Map.Entry<Enchantment, Integer> entry : ech2.entrySet()) {
for (Map.Entry<Enchantment, Integer> conflictsWith : enchantments.entrySet()) { for (Map.Entry<Enchantment, Integer> conflictsWith : enchantments.entrySet()) {
//Check if entry enchantments and conflictsWith enchantment conflict, and confirms that the enchantsments aren't the exact same. // Check if entry enchantment and conflictsWith enchantment conflict, and confirm that the enchantsments aren't the exact same.
if (entry.getKey().conflictsWith(conflictsWith.getKey()) && entry.getKey() != conflictsWith.getKey()) { if (entry.getKey().conflictsWith(conflictsWith.getKey()) && !entry.getKey().equals(conflictsWith.getKey())) {
conflicts = true; conflicts = true;
} }
} }
@ -128,7 +128,7 @@ public class BookBinder extends AContainer {
if (a.intValue() == b.intValue()) { if (a.intValue() == b.intValue()) {
//Confirm the entries enchant level doesnt go over the maximums unless it uses bypass-vanilla-max-level // Confirm the entry's enchant level doesn't go over the maximum unless it uses bypass-vanilla-max-level
if (enchantMaxLevel <= a && !bypassVanillaMaxLevel.getValue()) { if (enchantMaxLevel <= a && !bypassVanillaMaxLevel.getValue()) {
return enchantMaxLevel; return enchantMaxLevel;
} else if (hasCustomMaxLevel.getValue()) { } else if (hasCustomMaxLevel.getValue()) {
@ -139,7 +139,7 @@ public class BookBinder extends AContainer {
} else { } else {
int highestLevel = Math.max(a, b); int highestLevel = Math.max(a, b);
//Confirm the entries enchant level doesnt go over the maximums unless it uses bypass-vanilla-max-level // Confirm the entry's enchant level doesn't go over the maximum unless it uses bypass-vanilla-max-level
if (enchantMaxLevel <= highestLevel && !bypassVanillaMaxLevel.getValue()) { if (enchantMaxLevel <= highestLevel && !bypassVanillaMaxLevel.getValue()) {
return enchantMaxLevel; return enchantMaxLevel;
} else if (hasCustomMaxLevel.getValue()) { } else if (hasCustomMaxLevel.getValue()) {