Skip to content

Commit

Permalink
Fix Armor Enchant Strength
Browse files Browse the repository at this point in the history
Correct the order in which the args were in to apply the correct level.
  • Loading branch information
TrueDarkLord committed Feb 10, 2024
1 parent 79b8bf0 commit b5cbf5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -9,7 +9,7 @@ issues = https://github.com/Crazy-Crew/CrazyEnchantments/issues

group = com.badbones69.crazyenchantments
description = Adds over 80 unique enchantments to your server and more!
version = 2.2.1
version = 2.2.2
apiVersion = 1.20

minecraftVersion = 1.20.4
Expand Down
Expand Up @@ -124,19 +124,18 @@ private void newUpdateEffects(Player player, ItemStack newItem, ItemStack oldIte
if (currentEffect.getAmplifier() > effect.getValue()) break;
player.removePotionEffect(effect.getKey());
}
player.addPotionEffect(new PotionEffect(effect.getKey(), effect.getValue(), -1));
player.addPotionEffect(new PotionEffect(effect.getKey(), -1, effect.getValue()));
}
}
private Map<PotionEffectType, Integer> getTopPotionEffects(Map<CEnchantment, Integer> topEnchants) {
Map<CEnchantments, HashMap<PotionEffectType, Integer>> enchantmentPotions = crazyManager.getEnchantmentPotions();
HashMap<PotionEffectType, Integer> topPotions = new HashMap<>();

topEnchants.keySet()
.forEach((enchant) -> enchantmentPotions.entrySet()
.stream().filter(enchantedPotion -> enchantedPotion.getKey().getEnchantment().equals(enchant))
.forEach(enchantedPotion -> enchantedPotion.getValue().entrySet().stream()
topEnchants.forEach((key, value) -> enchantmentPotions.entrySet()
.stream().filter(enchantedPotion -> enchantedPotion.getKey().getEnchantment().equals(key))
.forEach(enchantedPotion -> enchantedPotion.getValue().entrySet().stream()
.filter(pot -> !topPotions.containsKey(pot.getKey()) || (topPotions.get(pot.getKey()) != -1 && topPotions.get(pot.getKey()) <= pot.getValue()))
.forEach(pot -> topPotions.put(pot.getKey(), pot.getValue()))));
.forEach(pot -> topPotions.put(pot.getKey(), value))));
return topPotions;
}

Expand Down

0 comments on commit b5cbf5c

Please sign in to comment.