mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-25 15:35:11 +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.add(enchantment);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
forRemoval.forEach(enchantment -> {
|
forRemoval.forEach(enchantment -> {
|
||||||
enchantments.remove(enchantment);
|
enchantments.remove(enchantment);
|
||||||
if (meta instanceof EnchantmentStorageMeta) {
|
if (meta instanceof EnchantmentStorageMeta) {
|
||||||
|
@ -9,17 +9,19 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class RarityAlphabeticSorter implements EnchantmentSorter {
|
public class RarityAlphabeticSorter implements EnchantmentSorter {
|
||||||
@Override
|
@Override
|
||||||
public void sortEnchantments(final @NotNull List<Enchantment> toSort) {
|
public void sortEnchantments(final @NotNull List<Enchantment> toSort) {
|
||||||
List<Enchantment> sorted = new ArrayList<>();
|
List<Enchantment> sorted = new ArrayList<>();
|
||||||
EnchantDisplay.OPTIONS.getSortedRarities().forEach(enchantmentRarity -> {
|
EnchantDisplay.OPTIONS.getSortedRarities().forEach(enchantmentRarity -> {
|
||||||
List<Enchantment> rarityEnchants = toSort.stream()
|
List<Enchantment> rarityEnchants = new ArrayList<>();
|
||||||
.filter(enchantment -> EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity))
|
toSort.forEach(enchantment -> {
|
||||||
.sorted((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()))
|
if (EnchantmentCache.getEntry(enchantment).getRarity().getName().equals(enchantmentRarity.getName())) {
|
||||||
.collect(Collectors.toList());
|
rarityEnchants.add(enchantment);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
rarityEnchants.sort((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()));
|
||||||
sorted.addAll(rarityEnchants);
|
sorted.addAll(rarityEnchants);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -10,17 +10,19 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class RarityLengthSorter implements EnchantmentSorter {
|
public class RarityLengthSorter implements EnchantmentSorter {
|
||||||
@Override
|
@Override
|
||||||
public void sortEnchantments(final @NotNull List<Enchantment> toSort) {
|
public void sortEnchantments(final @NotNull List<Enchantment> toSort) {
|
||||||
List<Enchantment> sorted = new ArrayList<>();
|
List<Enchantment> sorted = new ArrayList<>();
|
||||||
EnchantDisplay.OPTIONS.getSortedRarities().forEach(enchantmentRarity -> {
|
EnchantDisplay.OPTIONS.getSortedRarities().forEach(enchantmentRarity -> {
|
||||||
List<Enchantment> rarityEnchants = toSort.stream()
|
List<Enchantment> rarityEnchants = new ArrayList<>();
|
||||||
.filter(enchantment -> EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity))
|
toSort.forEach(enchantment -> {
|
||||||
.sorted(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()))
|
if (EnchantmentCache.getEntry(enchantment).getRarity().getName().equals(enchantmentRarity.getName())) {
|
||||||
.collect(Collectors.toList());
|
rarityEnchants.add(enchantment);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
rarityEnchants.sort(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()));
|
||||||
sorted.addAll(rarityEnchants);
|
sorted.addAll(rarityEnchants);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -21,10 +21,13 @@ public class RarityTypeAlphabeticSorter implements EnchantmentSorter {
|
|||||||
.sorted((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()))
|
.sorted((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
EnchantDisplay.OPTIONS.getSortedRarities().forEach(enchantmentRarity -> {
|
EnchantDisplay.OPTIONS.getSortedRarities().forEach(enchantmentRarity -> {
|
||||||
List<Enchantment> rarityEnchants = typeEnchants.stream()
|
List<Enchantment> rarityEnchants = new ArrayList<>();
|
||||||
.filter(enchantment -> EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity))
|
typeEnchants.forEach(enchantment -> {
|
||||||
.sorted((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()))
|
if (EnchantmentCache.getEntry(enchantment).getRarity().getName().equals(enchantmentRarity.getName())) {
|
||||||
.collect(Collectors.toList());
|
rarityEnchants.add(enchantment);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
rarityEnchants.sort((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()));
|
||||||
sorted.addAll(rarityEnchants);
|
sorted.addAll(rarityEnchants);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -22,11 +22,13 @@ public class RarityTypeLengthSorter implements EnchantmentSorter {
|
|||||||
.sorted(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()))
|
.sorted(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
EnchantDisplay.OPTIONS.getSortedRarities().forEach(enchantmentRarity -> {
|
EnchantDisplay.OPTIONS.getSortedRarities().forEach(enchantmentRarity -> {
|
||||||
List<Enchantment> rarityEnchants = typeEnchants.stream()
|
List<Enchantment> rarityEnchants = new ArrayList<>();
|
||||||
.filter(enchantment -> EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity))
|
typeEnchants.forEach(enchantment -> {
|
||||||
.sorted(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()))
|
if (EnchantmentCache.getEntry(enchantment).getRarity().getName().equals(enchantmentRarity.getName())) {
|
||||||
.collect(Collectors.toList());
|
rarityEnchants.add(enchantment);
|
||||||
sorted.addAll(rarityEnchants);
|
}
|
||||||
|
});
|
||||||
|
rarityEnchants.sort(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length()));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user