mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-22 15:05:18 +01:00
Fixed sorting by rarity not showing enchantments sometimes
This commit is contained in:
parent
8595083db5
commit
42283117c8
@ -215,7 +215,6 @@ public class EnchantDisplay {
|
||||
forRemoval.add(enchantment);
|
||||
}
|
||||
});
|
||||
|
||||
forRemoval.forEach(enchantment -> {
|
||||
enchantments.remove(enchantment);
|
||||
if (meta instanceof EnchantmentStorageMeta) {
|
||||
|
@ -9,17 +9,19 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class RarityAlphabeticSorter implements EnchantmentSorter {
|
||||
@Override
|
||||
public void sortEnchantments(final @NotNull List<Enchantment> toSort) {
|
||||
List<Enchantment> sorted = new ArrayList<>();
|
||||
EnchantDisplay.OPTIONS.getSortedRarities().forEach(enchantmentRarity -> {
|
||||
List<Enchantment> rarityEnchants = toSort.stream()
|
||||
.filter(enchantment -> EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity))
|
||||
.sorted((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()))
|
||||
.collect(Collectors.toList());
|
||||
List<Enchantment> rarityEnchants = new ArrayList<>();
|
||||
toSort.forEach(enchantment -> {
|
||||
if (EnchantmentCache.getEntry(enchantment).getRarity().getName().equals(enchantmentRarity.getName())) {
|
||||
rarityEnchants.add(enchantment);
|
||||
}
|
||||
});
|
||||
rarityEnchants.sort((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()));
|
||||
sorted.addAll(rarityEnchants);
|
||||
});
|
||||
|
||||
|
@ -10,17 +10,19 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class RarityLengthSorter implements EnchantmentSorter {
|
||||
@Override
|
||||
public void sortEnchantments(final @NotNull List<Enchantment> toSort) {
|
||||
List<Enchantment> sorted = new ArrayList<>();
|
||||
EnchantDisplay.OPTIONS.getSortedRarities().forEach(enchantmentRarity -> {
|
||||
List<Enchantment> rarityEnchants = toSort.stream()
|
||||
.filter(enchantment -> EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity))
|
||||
.sorted(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()))
|
||||
.collect(Collectors.toList());
|
||||
List<Enchantment> rarityEnchants = new ArrayList<>();
|
||||
toSort.forEach(enchantment -> {
|
||||
if (EnchantmentCache.getEntry(enchantment).getRarity().getName().equals(enchantmentRarity.getName())) {
|
||||
rarityEnchants.add(enchantment);
|
||||
}
|
||||
});
|
||||
rarityEnchants.sort(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()));
|
||||
sorted.addAll(rarityEnchants);
|
||||
});
|
||||
|
||||
|
@ -21,10 +21,13 @@ public class RarityTypeAlphabeticSorter implements EnchantmentSorter {
|
||||
.sorted((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()))
|
||||
.collect(Collectors.toList());
|
||||
EnchantDisplay.OPTIONS.getSortedRarities().forEach(enchantmentRarity -> {
|
||||
List<Enchantment> rarityEnchants = typeEnchants.stream()
|
||||
.filter(enchantment -> EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity))
|
||||
.sorted((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()))
|
||||
.collect(Collectors.toList());
|
||||
List<Enchantment> rarityEnchants = new ArrayList<>();
|
||||
typeEnchants.forEach(enchantment -> {
|
||||
if (EnchantmentCache.getEntry(enchantment).getRarity().getName().equals(enchantmentRarity.getName())) {
|
||||
rarityEnchants.add(enchantment);
|
||||
}
|
||||
});
|
||||
rarityEnchants.sort((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()));
|
||||
sorted.addAll(rarityEnchants);
|
||||
});
|
||||
});
|
||||
|
@ -22,11 +22,13 @@ public class RarityTypeLengthSorter implements EnchantmentSorter {
|
||||
.sorted(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()))
|
||||
.collect(Collectors.toList());
|
||||
EnchantDisplay.OPTIONS.getSortedRarities().forEach(enchantmentRarity -> {
|
||||
List<Enchantment> rarityEnchants = typeEnchants.stream()
|
||||
.filter(enchantment -> EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity))
|
||||
.sorted(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()))
|
||||
.collect(Collectors.toList());
|
||||
sorted.addAll(rarityEnchants);
|
||||
List<Enchantment> rarityEnchants = new ArrayList<>();
|
||||
typeEnchants.forEach(enchantment -> {
|
||||
if (EnchantmentCache.getEntry(enchantment).getRarity().getName().equals(enchantmentRarity.getName())) {
|
||||
rarityEnchants.add(enchantment);
|
||||
}
|
||||
});
|
||||
rarityEnchants.sort(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()));
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user